Package org.teleight.teleightbots.bot
Interface TelegramBot
- All Known Subinterfaces:
LongPollingTelegramBot,WebhookTelegramBot
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 Summary
Modifier and TypeMethodDescriptiondefault @NotNull MenucreateMenu(@Nullable String name, Menu.Builder builder) Creates a new menu with a specified name using the provided builder.default @NotNull MenucreateMenu(Menu.Builder builder) Creates a new menu using the provided builder.default <R extends Serializable>
@NotNull CompletableFuture<R> Sends a request to the Telegram Bot API using the given method.@NotNull BotSettingsRetrieves the bot's configuration settings.@NotNull StringRetrieves the bot's token used to authenticate with the Telegram Bot API.@NotNull StringRetrieves the username of the bot.@NotNull CommandManagerProvides access to the bot's command manager.@NotNull ConversationManagerProvides access to the bot's conversation manager.@NotNull EventManagerProvides access to the bot's event manager.@NotNull ExtensionManagerProvides access to the bot's extension manager.@NotNull FileDownloaderProvides access to the bot's file downloader.@NotNull MenuManagerProvides access to the bot's menu manager.@NotNull SchedulerProvides access to the bot's task scheduler.default @NotNull CompletableFuture<ChatMember> Returns the chat member with the given user id in the given chat.default @NotNull CompletableFuture<ChatMember> Returns the chat member with the given user id in the given chat.default @NotNull CompletableFuture<ChatMember> Returns the chat member with the given user id in the given chat.default @NotNull CompletableFuture<ChatMember> Returns the chat member with the given user id in the given chat.
-
Method Details
-
getBotToken
Retrieves the bot's token used to authenticate with the Telegram Bot API.- Returns:
- the authentication token of the bot
-
getBotUsername
Retrieves the username of the bot.- Returns:
- the username of the bot
-
getScheduler
Provides access to the bot's task scheduler.- Returns:
- the task scheduler associated with the bot
-
getBotSettings
Retrieves the bot's configuration settings.- Returns:
- the settings of the bot
-
getEventManager
Provides access to the bot's event manager.- Returns:
- the event manager associated with the bot
-
getMenuManager
Provides access to the bot's menu manager.- Returns:
- the menu manager associated with the bot
-
getCommandManager
Provides access to the bot's command manager.- Returns:
- the command manager associated with the bot
-
getExtensionManager
Provides access to the bot's extension manager.- Returns:
- the extension manager associated with the bot
-
getFileDownloader
Provides access to the bot's file downloader.- Returns:
- the file downloader associated with the bot
-
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 objectuser- 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 objectuserId- 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 iduser- 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 iduserId- the user id- Returns:
- a future representing the result of the request
-
getBotMethodExecutor
-
getUpdateProcessor
-