io.github.dehuckakpyt.telegrambot.resolver.UpdateResolverImpl.kt Maven / Gradle / Ivy
Show all versions of telegram-bot-core Show documentation
package io.github.dehuckakpyt.telegrambot.resolver
import io.github.dehuckakpyt.telegrambot.model.telegram.Update
/**
* Created on 08.12.2023.
*
*
* @author Denis Matytsin
*/
class UpdateResolverImpl internal constructor(
private val dialogUpdateResolver: DialogUpdateResolver,
private val eventUpdateResolver: EventUpdateResolver,
) : UpdateResolver {
override suspend fun processUpdate(update: Update): Unit = with(update) {
eventUpdateResolver.processUpdate(this)
when {
message != null -> dialogUpdateResolver.processMessage(message)
callbackQuery != null -> dialogUpdateResolver.processCallback(callbackQuery)
}
}
override val allowedUpdates: Set
get() = buildSet {
addAll(eventUpdateResolver.allowedUpdates)
addAll(dialogUpdateResolver.allowedUpdates)
}
}