Package com.jtelegram.api
Class TelegramBotRegistry
- java.lang.Object
-
- com.jtelegram.api.TelegramBotRegistry
-
public class TelegramBotRegistry extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTelegramBotRegistry.TelegramBotRegistryBuilder
-
Field Summary
Fields Modifier and Type Field Description static com.google.gson.GsonGSON
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TelegramBotRegistry.TelegramBotRegistryBuilderbuilder()java.lang.StringgetApiUrl()java.util.Set<TelegramBot>getBots()okhttp3.OkHttpClientgetClient()intgetEventThreadCount()java.lang.StringgetFileApiUrl()static java.util.function.Consumer<TelegramException>getMinorGsonErrorHandler()UpdateProvidergetUpdateProvider()voidregisterBot(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.voidsetHttpClient(okhttp3.OkHttpClient client)static voidsetMinorGsonErrorHandler(java.util.function.Consumer<TelegramException> minorGsonErrorHandler)
-
-
-
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 Keycallback- Callback
-
builder
public static TelegramBotRegistry.TelegramBotRegistryBuilder builder()
-
getUpdateProvider
public UpdateProvider getUpdateProvider()
-
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()
-
-