Class BotCommand
java.lang.Object
org.telegram.telegrambots.extensions.bots.commandbot.commands.BotCommand
- All Implemented Interfaces:
IBotCommand
- Direct Known Subclasses:
DefaultBotCommand,ManCommand
Representation of a command, which can be executed
- Author:
- Timo Schulz (Mit0x2)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBotCommand(String commandIdentifier, String description) Construct a command -
Method Summary
Modifier and TypeMethodDescriptionabstract voidexecute(org.telegram.telegrambots.meta.bots.AbsSender absSender, org.telegram.telegrambots.meta.api.objects.User user, org.telegram.telegrambots.meta.api.objects.Chat chat, String[] arguments) Execute the commandfinal StringGet the identifier of this commandfinal StringGet the description of this commandvoidprocessMessage(org.telegram.telegrambots.meta.bots.AbsSender absSender, org.telegram.telegrambots.meta.api.objects.Message message, String[] arguments) Process the message and execute the commandtoString()
-
Field Details
-
COMMAND_INIT_CHARACTER
- See Also:
-
COMMAND_PARAMETER_SEPARATOR_REGEXP
- See Also:
-
-
Constructor Details
-
BotCommand
Construct a command- Parameters:
commandIdentifier- the unique identifier of this command (e.g. the command string to enter into chat)description- the description of this command
-
-
Method Details
-
getCommandIdentifier
Get the identifier of this command- Specified by:
getCommandIdentifierin interfaceIBotCommand- Returns:
- the identifier
-
getDescription
Get the description of this command- Specified by:
getDescriptionin interfaceIBotCommand- Returns:
- the description as String
-
toString
-
processMessage
public void processMessage(org.telegram.telegrambots.meta.bots.AbsSender absSender, org.telegram.telegrambots.meta.api.objects.Message message, String[] arguments) Process the message and execute the command- Specified by:
processMessagein interfaceIBotCommand- Parameters:
absSender- absSender to send messages overmessage- the message to processarguments- passed arguments
-
execute
public abstract void execute(org.telegram.telegrambots.meta.bots.AbsSender absSender, org.telegram.telegrambots.meta.api.objects.User user, org.telegram.telegrambots.meta.api.objects.Chat chat, String[] arguments) Execute the command- Parameters:
absSender- absSender to send messages overuser- the user who sent the commandchat- the chat, to be able to send repliesarguments- passed arguments
-