mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2025-09-15 13:19:21 +00:00
update up to 4.0.0
This commit is contained in:
@@ -20,33 +20,17 @@ suspend fun activateResenderBot(
|
||||
|
||||
bot.buildBehaviourWithLongPolling(CoroutineScope(currentCoroutineContext() + SupervisorJob())) {
|
||||
onContentMessage(
|
||||
initialFilter = CommonMessageFilterExcludeMediaGroups,
|
||||
subcontextUpdatesFilter = MessageFilterByChat
|
||||
) {
|
||||
val chat = it.chat
|
||||
withTypingAction(chat) {
|
||||
|
||||
val answer = withTypingAction(chat) {
|
||||
executeUnsafe(it.content.createResend(chat.id, replyToMessageId = it.messageId)) {
|
||||
it.forEach(print)
|
||||
}
|
||||
}
|
||||
}
|
||||
onVisualGallery {
|
||||
val chat = it.chat ?: return@onVisualGallery
|
||||
withUploadPhotoAction(chat) {
|
||||
send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
}
|
||||
}
|
||||
onPlaylist {
|
||||
val chat = it.chat ?: return@onPlaylist
|
||||
withUploadDocumentAction(chat) {
|
||||
send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
}
|
||||
}
|
||||
onDocumentsGroup {
|
||||
val chat = it.chat ?: return@onDocumentsGroup
|
||||
withUploadDocumentAction(chat) {
|
||||
send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
}
|
||||
|
||||
println("Answer info: $answer")
|
||||
}
|
||||
|
||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
||||
|
Reference in New Issue
Block a user