Class BotCommand
- java.lang.Object
-
- org.telegram.telegrambots.extensions.bots.commandbot.commands.BotCommand
-
- All Implemented Interfaces:
IBotCommand
- Direct Known Subclasses:
DefaultBotCommand,ManCommand
public abstract class BotCommand extends Object implements IBotCommand
Representation of a command, which can be executed- Author:
- Timo Schulz (Mit0x2)
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMMAND_INIT_CHARACTERstatic StringCOMMAND_PARAMETER_SEPARATOR_REGEXP
-
Constructor Summary
Constructors Constructor Description BotCommand(String commandIdentifier, String description)Construct a command
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract 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 commandStringgetCommandIdentifier()Get the identifier of this commandStringgetDescription()Get 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 commandStringtoString()
-
-
-
Field Detail
-
COMMAND_INIT_CHARACTER
public static final String COMMAND_INIT_CHARACTER
- See Also:
- Constant Field Values
-
COMMAND_PARAMETER_SEPARATOR_REGEXP
public static final String COMMAND_PARAMETER_SEPARATOR_REGEXP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCommandIdentifier
public final String getCommandIdentifier()
Get the identifier of this command- Specified by:
getCommandIdentifierin interfaceIBotCommand- Returns:
- the identifier
-
getDescription
public final String getDescription()
Get the description of this command- Specified by:
getDescriptionin interfaceIBotCommand- Returns:
- the description as String
-
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
-
-