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
public class HelpCommand extends ManCommand
A special bot command used for printing help messages similiar to the Linux man command. The commands printed by this command should implement theIManCommandinterface 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
Constructors Constructor Description HelpCommand()Create 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 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, toMan
-
Methods inherited from class org.telegram.telegrambots.extensions.bots.commandbot.commands.BotCommand
getCommandIdentifier, getDescription, processMessage, toString
-
-
-
-
Constructor Detail
-
HelpCommand
public HelpCommand()
Create a Help command with the standard Arguments.
-
HelpCommand
public HelpCommand(String commandIdentifier, String description, String extendedDescription)
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 Detail
-
getHelpText
public static String getHelpText(IBotCommand... botCommands)
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
public static String getHelpText(Collection<IBotCommand> botCommands)
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
public static String getHelpText(ICommandRegistry registry)
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
public static String getManText(IBotCommand command)
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
public static String getManText(IManCommand command)
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
-
-