Interface CommandManager
public sealed interface CommandManager
Basic interface for a CommandManager. Provides methods to manage commands.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancommandExists(@NotNull String commandName) Checks if a Command exists.voidExecutes a Command.extractCommand(String text) Extracts a Command from a text string.@Nullable CommandgetCommand(@NotNull String commandName) Returns a Command by its name.static @NotNull CommandManagernewCommandManager(@NotNull TelegramBot bot) voidregisterCommand(@NotNull Command command) Registers a new command from a Command instance.
-
Method Details
-
newCommandManager
@Internal @NotNull static @NotNull CommandManager newCommandManager(@NotNull @NotNull TelegramBot bot) -
registerCommand
Registers a new command from a Command instance.- Parameters:
command- The command to be registered.
-
getCommand
Returns a Command by its name.- Parameters:
commandName- The name of the Command to return.- Returns:
- The Command with the given name, or null if it does not exist.
-
commandExists
Checks if a Command exists.- Parameters:
commandName- The name of the Command to check.- Returns:
- True if the Command exists, false otherwise.
-
execute
Executes a Command.- Parameters:
sender- The User who is executing the Command.fullText- The full text of the Command.message- The Message that contains the Command.
-
extractCommand
Extracts a Command from a text string.- Parameters:
text- The text string to extract the Command from.- Returns:
- The extracted Command.
-