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 class
TelegramBotRegistry.TelegramBotRegistryBuilder
-
Field Summary
Fields Modifier and Type Field Description static com.google.gson.Gson
GSON
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TelegramBotRegistry.TelegramBotRegistryBuilder
builder()
java.lang.String
getApiUrl()
java.util.Set<TelegramBot>
getBots()
okhttp3.OkHttpClient
getClient()
int
getEventThreadCount()
java.lang.String
getFileApiUrl()
static java.util.function.Consumer<TelegramException>
getMinorGsonErrorHandler()
UpdateProvider
getUpdateProvider()
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.void
setHttpClient(okhttp3.OkHttpClient client)
static void
setMinorGsonErrorHandler(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()
-
-