Interface TelegramBot

All Known Subinterfaces:
LongPollingTelegramBot, WebhookTelegramBot

public sealed interface TelegramBot permits WebhookTelegramBot, LongPollingTelegramBot
Generic interface representing a Telegram Bot.

This interface provides methods to interact with the bot and its components. It also provides methods to send requests to the Telegram Bot API.

See Also:
  • Method Details

    • getBotToken

      @NotNull @NotNull String getBotToken()
      Retrieves the bot's token used to authenticate with the Telegram Bot API.
      Returns:
      the authentication token of the bot
    • getBotUsername

      @NotNull @NotNull String getBotUsername()
      Retrieves the username of the bot.
      Returns:
      the username of the bot
    • getScheduler

      @NotNull @NotNull Scheduler getScheduler()
      Provides access to the bot's task scheduler.
      Returns:
      the task scheduler associated with the bot
    • getBotSettings

      @NotNull @NotNull BotSettings getBotSettings()
      Retrieves the bot's configuration settings.
      Returns:
      the settings of the bot
    • getEventManager

      @NotNull @NotNull EventManager getEventManager()
      Provides access to the bot's event manager.
      Returns:
      the event manager associated with the bot
    • getMenuManager

      @NotNull @NotNull MenuManager getMenuManager()
      Provides access to the bot's menu manager.
      Returns:
      the menu manager associated with the bot
    • createMenu

      @NotNull default @NotNull Menu createMenu(@NotNull Menu.Builder builder)
      Creates a new menu using the provided builder.
      Parameters:
      builder - the builder to construct the menu
      Returns:
      the created menu
    • createMenu

      @NotNull default @NotNull Menu createMenu(@Nullable @Nullable String name, @NotNull Menu.Builder builder)
      Creates a new menu with a specified name using the provided builder.
      Parameters:
      name - the name of the menu (can be null)
      builder - the builder used to create the menu
      Returns:
      the created menu
    • getCommandManager

      @NotNull @NotNull CommandManager getCommandManager()
      Provides access to the bot's command manager.
      Returns:
      the command manager associated with the bot
    • getExtensionManager

      @NotNull @NotNull ExtensionManager getExtensionManager()
      Provides access to the bot's extension manager.
      Returns:
      the extension manager associated with the bot
    • getFileDownloader

      @NotNull @NotNull FileDownloader getFileDownloader()
      Provides access to the bot's file downloader.
      Returns:
      the file downloader associated with the bot
    • getConversationManager

      @NotNull @NotNull ConversationManager getConversationManager()
      Provides access to the bot's conversation manager.

      The conversation manager handles interactions with users and conversation flows.

      Returns:
      the conversation manager associated with the bot
    • execute

      @NotNull default <R extends Serializable> @NotNull CompletableFuture<R> execute(@NotNull @NotNull ApiMethod<R> method)
      Sends a request to the Telegram Bot API using the given method.
      Type Parameters:
      R - the type of the expected response
      Parameters:
      method - the method used to create the request
      Returns:
      a future representing the result of the request
    • getUser

      @NotNull default @NotNull CompletableFuture<ChatMember> getUser(@NotNull @NotNull Chat chat, @NotNull @NotNull User user)
      Returns the chat member with the given user id in the given chat.
      Parameters:
      chat - the chat object
      user - the user object
      Returns:
      a future representing the result of the request
    • getUser

      @NotNull default @NotNull CompletableFuture<ChatMember> getUser(@NotNull @NotNull Chat chat, long userId)
      Returns the chat member with the given user id in the given chat.
      Parameters:
      chat - the chat object
      userId - the user id
      Returns:
      a future representing the result of the request
    • getUser

      @NotNull default @NotNull CompletableFuture<ChatMember> getUser(@NotNull @NotNull String chatId, @NotNull @NotNull User user)
      Returns the chat member with the given user id in the given chat.
      Parameters:
      chatId - the chat id
      user - the user object
      Returns:
      a future representing the result of the request
    • getUser

      @NotNull default @NotNull CompletableFuture<ChatMember> getUser(@NotNull @NotNull String chatId, long userId)
      Returns the chat member with the given user id in the given chat.
      Parameters:
      chatId - the chat id
      userId - the user id
      Returns:
      a future representing the result of the request
    • getBotMethodExecutor

      @Internal BotMethodExecutor getBotMethodExecutor()
    • getUpdateProcessor

      @Internal UpdateProcessor getUpdateProcessor()