mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2026-11-27 05:43:14 +00:00
update examples for ktgbotapi 38.0.0
This commit is contained in:
1 parent
d0da6c851b
commit
97b4391495
86 files changed
+888
-370
No files matched your search
@@ -8,8 +8,8 @@ points start it in platform-specific ways.
|
||||
|
||||
The bot defines no commands. For each content message, it shows a typing action and
|
||||
uses `createResend` to send equivalent content back to the originating chat. When
|
||||
present, it carries over the replied-to message metadata, text quote entities and
|
||||
position, and the message effect ID.
|
||||
present, it carries over the replied-to message metadata, quote entities, rich-text
|
||||
selections, their UTF-16 position, and the message effect ID.
|
||||
|
||||
Business content sent by the business-connection owner is ignored; other delivered
|
||||
content messages are eligible. Processing is separated by chat. The bot prints each
|
||||
|
||||
@@ -15,8 +15,7 @@ plugins {
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
// js(LEGACY) {
|
||||
js(IR) {
|
||||
js {
|
||||
browser()
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
@@ -9,10 +9,9 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAn
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onContentMessage
|
||||
import dev.inmo.tgbotapi.extensions.utils.possiblyWithEffectMessageOrNull
|
||||
import dev.inmo.tgbotapi.extensions.utils.shortcuts.executeUnsafe
|
||||
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
|
||||
import dev.inmo.tgbotapi.types.ReplyParameters
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalQuoteInfo
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -49,11 +48,13 @@ suspend fun activateResenderBot(
|
||||
it.content.createResend(
|
||||
chat.id,
|
||||
replyParameters = it.replyInfo?.messageMeta?.let { meta ->
|
||||
val quote = it.withContentOrNull<TextContent>()?.content?.quote
|
||||
val quote = (it.content as? WithOptionalQuoteInfo)?.quote
|
||||
?: return@let ReplyParameters(meta)
|
||||
ReplyParameters(
|
||||
meta,
|
||||
entities = quote?.textSources ?: emptyList(),
|
||||
quotePosition = quote?.position
|
||||
entities = quote.textSources,
|
||||
quotePosition = quote.position,
|
||||
quoteRichTexts = quote.richTexts
|
||||
)
|
||||
},
|
||||
effectId = it.possiblyWithEffectMessageOrNull()?.effectId
|
||||
|
||||
@@ -11,7 +11,7 @@ buildscript {
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'application'
|
||||
|
||||
mainClassName="ResenderBotJvmKt"
|
||||
application.mainClass = "ResenderBotJvmKt"
|
||||
|
||||
|
||||
dependencies {
|
||||
|
||||
Reference in new issue
Block a user