-
-
Notifications
You must be signed in to change notification settings - Fork 17
F.A.Q
If you getting such exception on the startup of your application:
Exception in thread "DefaultDispatcher-worker-1" java.lang.AbstractMethodError: 'kotlinx.serialization.KSerializer[] kotlinx.serialization.internal.GeneratedSerializer.typeParametersSerializers()'
at eu.vendeli.tgbot.types.options.GetUpdatesOptions$$serializer.typeParametersSerializers(GetUpdatesOptions.kt:6)It happening because your build system resolving old serialization library which internal mechanics differs. To solve it you should make it use more newer version, for example by adding this to your buildscript:
configurations.all {
resolutionStrategy.eachDependency {
val serdeVer = "x.x.x" // should be >= 1.8.0
when(requested.module.toString()) {
// json serialiazaton
"org.jetbrains.kotlinx:kotlinx-serialization-json" -> useVersion(serdeVer)
"org.jetbrains.kotlinx:kotlinx-serialization-json-jvm" -> useVersion(serdeVer)
"org.jetbrains.kotlinx:kotlinx-serialization-core" -> useVersion(serdeVer)
"org.jetbrains.kotlinx:kotlinx-serialization-core-jvm" -> useVersion(serdeVer)
"org.jetbrains.kotlinx:kotlinx-serialization-bom" -> useVersion(serdeVer)
}
}
}(If it was well described in changelog I would never upgraded it bc I getting so much reports on this issue)
To get a response and be able to operate over, you need to use sendReturning at the end of the method instead of send.
In this case the Response class is returned, which contains the response, success or failure, further you need to either handle the failure or just call getOrNull().
There's section about: Processing responses.
This happens because spring-boot-devtools has its own classloader and it does not find methods.
You need to add to resources/META-INF/spring-devtools.properties:
restart.include.generated=/eu.vendeliIf you want to change the engine used by the client you can simply change the parameter in the plugin settings.
The library uses slf4j-api and to use the provider you just need to add it to the dependencies.
The library plugin automatically detects the use of the provider, if provider is missing, logback will be used by default.
For example if you have an unstable connection and need to catch an error because of this, perhaps this approach will help you:
fun main() {
val bot = TelegramBot("TOKEN")
try {
bot.handleUpdates()
} catch (e: Exception) {
// handle if needed
bot.update.stopListener()
bot.handleUpdates()
}
}Also you can take a look how it's done in spring-starter.
Telegram bot Wiki © KtGram