Interface CommandManager


public sealed interface CommandManager
Basic interface for a CommandManager. Provides methods to manage commands.
See Also:
  • Method Details

    • newCommandManager

      @Internal @NotNull static @NotNull CommandManager newCommandManager(@NotNull @NotNull TelegramBot bot)
    • registerCommand

      void registerCommand(@NotNull @NotNull Command command)
      Registers a new command from a Command instance.
      Parameters:
      command - The command to be registered.
    • getCommand

      @Nullable @Nullable Command getCommand(@NotNull @NotNull String commandName)
      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

      boolean commandExists(@NotNull @NotNull String commandName)
      Checks if a Command exists.
      Parameters:
      commandName - The name of the Command to check.
      Returns:
      True if the Command exists, false otherwise.
    • execute

      void execute(@NotNull @NotNull User sender, @NotNull @NotNull String fullText, Message message)
      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

      String extractCommand(String text)
      Extracts a Command from a text string.
      Parameters:
      text - The text string to extract the Command from.
      Returns:
      The extracted Command.