Skip to content

Commit

Permalink
#241 telegram channel webhook mode
Browse files Browse the repository at this point in the history
  • Loading branch information
morfeusys committed Nov 2, 2022
1 parent 07a46b2 commit ef58ed4
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -49,6 +49,8 @@ class TelegramChannel(
token = telegramBotToken
botUpdater = updater

botUpdater.startCheckingUpdates()

dispatch {
fun process(request: TelegramBotRequest) {
botApi.process(request, TelegramReactions(bot, request, liveChatProvider), RequestContext.fromHttp(request.update.httpBotRequest))
Expand Down Expand Up @@ -139,6 +141,7 @@ class TelegramChannel(
}

fun run() {
botUpdater.stopCheckingUpdates()
bot.startPolling()
}

Expand All @@ -150,7 +153,6 @@ class TelegramChannel(
liveChatProvider: JaicpLiveChatProvider
) = TelegramChannel(botApi, telegramApiUrl = apiUrl, telegramBotToken = "").apply {
this.liveChatProvider = liveChatProvider
this.botUpdater.startCheckingUpdates()
}

private const val REQUEST_TEMPLATE_PATH = "/TelegramRequestTemplate.json"
Expand Down

0 comments on commit ef58ed4

Please sign in to comment.