Class TelegramBotRegistry


  • public class TelegramBotRegistry
    extends java.lang.Object
    • Field Detail

      • GSON

        public static final com.google.gson.Gson GSON
    • Method Detail

      • setMinorGsonErrorHandler

        public static void setMinorGsonErrorHandler​(java.util.function.Consumer<TelegramException> minorGsonErrorHandler)
      • getMinorGsonErrorHandler

        public static java.util.function.Consumer<TelegramException> getMinorGsonErrorHandler()
      • setHttpClient

        public void setHttpClient​(okhttp3.OkHttpClient client)
      • registerBot

        public void registerBot​(java.lang.String apiKey,
                                java.util.function.BiConsumer<TelegramBot,​TelegramException> callback)
        Registers the bot and makes a request to telegram to verify the apiKey is correct This action will be performed on the bot's dedicated request queue, and thus a callback must be used. The callback takes a similar approach of a promise in JS. If the verification was successful, the bot will be non-null and the exception will be null and vice-versa.
        Parameters:
        apiKey - The Telegram bot's API Key
        callback - Callback
      • getApiUrl

        public java.lang.String getApiUrl()
      • getFileApiUrl

        public java.lang.String getFileApiUrl()
      • getClient

        public okhttp3.OkHttpClient getClient()
      • getEventThreadCount

        public int getEventThreadCount()
      • getBots

        public java.util.Set<TelegramBot> getBots()