Class BotCommand
Object
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 the commandfinal StringGet the identifier of this commandfinal StringGet the description of this commandvoidprocessMessage(TelegramClient telegramClient, 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
Process the message and execute the command- Specified by:
processMessagein interfaceIBotCommand- Parameters:
telegramClient- Client to send messages overmessage- the message to processarguments- passed arguments
-
execute
public abstract void execute(TelegramClient telegramClient, User user, Chat chat, String[] arguments) Execute the command- Parameters:
telegramClient- Client to send messages overuser- the user who sent the commandchat- the chat, to be able to send repliesarguments- passed arguments
-