Class HelpCommand
java.lang.Object
org.telegram.telegrambots.extensions.bots.commandbot.commands.BotCommand
org.telegram.telegrambots.extensions.bots.commandbot.commands.helpCommand.ManCommand
org.telegram.telegrambots.extensions.bots.commandbot.commands.helpCommand.HelpCommand
- All Implemented Interfaces:
IManCommand,IBotCommand
A special bot command used for printing help messages similiar to the Linux man command.
The commands printed by this command should implement the
IManCommand interface to provide an extended description.- Version:
- 1.0.0
- Author:
- Lukas Prediger(Chase)
-
Field Summary
Fields inherited from class org.telegram.telegrambots.extensions.bots.commandbot.commands.BotCommand
COMMAND_INIT_CHARACTER, COMMAND_PARAMETER_SEPARATOR_REGEXP -
Constructor Summary
ConstructorsConstructorDescriptionCreate a Help command with the standard Arguments.HelpCommand(String commandIdentifier, String description, String extendedDescription) Creates a Help Command with custom identifier, description and extended Description -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(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 commandstatic StringgetHelpText(Collection<IBotCommand> botCommands) Returns the command and description of all supplied commands as a formatted Stringstatic StringgetHelpText(IBotCommand... botCommands) Returns the command and description of all supplied commands as a formatted Stringstatic StringgetHelpText(ICommandRegistry registry) Returns the command and description of all supplied commands as a formatted Stringstatic StringgetManText(IManCommand command) Reads the extended Description from a BotCommand;static StringgetManText(IBotCommand command) Reads the extended Description from a BotCommand.Methods inherited from class org.telegram.telegrambots.extensions.bots.commandbot.commands.helpCommand.ManCommand
getExtendedDescription, toManMethods inherited from class org.telegram.telegrambots.extensions.bots.commandbot.commands.BotCommand
getCommandIdentifier, getDescription, processMessage, toString
-
Constructor Details
-
HelpCommand
public HelpCommand()Create a Help command with the standard Arguments. -
HelpCommand
Creates a Help Command with custom identifier, description and extended Description- Parameters:
commandIdentifier- the unique identifier of this command (e.g. the command string to enter into chat)description- the description of this commandextendedDescription- The extended Description for the Command, should provide detailed information about arguments and possible options
-
-
Method Details
-
getHelpText
Returns the command and description of all supplied commands as a formatted String- Parameters:
botCommands- the Commands that should be included in the String- Returns:
- a formatted String containing command and description for all supplied commands
-
getHelpText
Returns the command and description of all supplied commands as a formatted String- Parameters:
botCommands- a collection of commands that should be included in the String- Returns:
- a formatted String containing command and description for all supplied commands
-
getHelpText
Returns the command and description of all supplied commands as a formatted String- Parameters:
registry- a commandRegistry which commands are formatted into the String- Returns:
- a formatted String containing command and description for all supplied commands
-
getManText
Reads the extended Description from a BotCommand. If the Command is not of TypeIManCommand, it calls toString();- Parameters:
command- a command the extended Descriptions is read from- Returns:
- the extended Description or the toString() if IManCommand is not implemented
-
getManText
Reads the extended Description from a BotCommand;- Parameters:
command- a command the extended Descriptions is read from- Returns:
- the extended Description
-
execute
public 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) Description copied from class:BotCommandExecute the command- Specified by:
executein classBotCommand- Parameters:
absSender- absSender to send messages overuser- the user who sent the commandchat- the chat, to be able to send repliesarguments- passed arguments
-