mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-11-22 08:13:53 +00:00
small update
This commit is contained in:
parent
09416a0ba0
commit
1c509ed8cd
@ -1,3 +1,4 @@
|
|||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.getMe
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.setMyCommands
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.setMyCommands
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media.sendDocument
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media.sendDocument
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.sendTextMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.sendTextMessage
|
||||||
@ -49,6 +50,7 @@ suspend fun main(args: Array<String>) {
|
|||||||
bot.setMyCommands(
|
bot.setMyCommands(
|
||||||
BotCommand(command, "Send some random file in picker directory")
|
BotCommand(command, "Send some random file in picker directory")
|
||||||
)
|
)
|
||||||
|
println(bot.getMe())
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.coroutineContext[Job]!!.join()
|
scope.coroutineContext[Job]!!.join()
|
||||||
|
@ -23,14 +23,17 @@ suspend fun activateResenderBot(
|
|||||||
bot.startGettingFlowsUpdatesByLongPolling {
|
bot.startGettingFlowsUpdatesByLongPolling {
|
||||||
filterContentMessages<MessageContent>(scope).onEach {
|
filterContentMessages<MessageContent>(scope).onEach {
|
||||||
it.content.createResends(it.chat.id, replyToMessageId = it.messageId).forEach {
|
it.content.createResends(it.chat.id, replyToMessageId = it.messageId).forEach {
|
||||||
bot.executeUnsafe(it) ?.also {
|
bot.executeUnsafe(it) {
|
||||||
|
it.forEach(print)
|
||||||
|
} ?.also {
|
||||||
print(it)
|
print(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.launchIn(scope)
|
}.launchIn(scope)
|
||||||
filterMediaGroupMessages<MediaGroupContent>(scope).onEach {
|
mediaGroupMessages(scope).onEach {
|
||||||
safely {
|
safely({ print(it.stackTraceToString()) }) {
|
||||||
bot.executeUnsafe(it.createResend(it.chat ?: return@safely, replyTo = it.first().messageId)).also {
|
println(it.chat)
|
||||||
|
bot.execute(it.createResend(it.chat ?: return@safely, replyTo = it.first().messageId)).also {
|
||||||
print(it)
|
print(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user