mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-12-22 16:47:18 +00:00
commit
0f2b3760dd
@ -1,5 +1,6 @@
|
||||
import dev.inmo.micro_utils.coroutines.AccumulatorFlow
|
||||
import dev.inmo.micro_utils.fsm.common.State
|
||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||
import dev.inmo.tgbotapi.extensions.api.send.sendMessage
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.*
|
||||
@ -55,7 +56,7 @@ suspend fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
strictlyOn<StopState> {
|
||||
sendMessage(it.context, "You have stopped sending of content")
|
||||
send(it.context, "You have stopped sending of content")
|
||||
|
||||
null
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.extensions.api.chat.get.getChat
|
||||
import dev.inmo.tgbotapi.extensions.api.send.reply
|
||||
import dev.inmo.tgbotapi.extensions.api.send.sendTextMessage
|
||||
import dev.inmo.tgbotapi.extensions.api.send.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onContentMessage
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.linkMarkdownV2
|
||||
@ -27,7 +26,7 @@ suspend fun main(vararg args: String) {
|
||||
val chat = message.chat
|
||||
if (chat is ChannelChat) {
|
||||
val answer = "Hi everybody in this channel \"${chat.title}\""
|
||||
sendTextMessage(chat, answer, MarkdownV2)
|
||||
send(chat, answer, MarkdownV2)
|
||||
return@onContentMessage
|
||||
}
|
||||
val answerText = "Oh, hi, " + when (chat) {
|
||||
|
@ -3,7 +3,7 @@ import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
||||
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.answers.answer
|
||||
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||
import dev.inmo.tgbotapi.extensions.api.send.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||
@ -88,7 +88,7 @@ suspend fun activateKeyboardsBot(
|
||||
|
||||
val text = "This is $page of $count"
|
||||
|
||||
editMessageText(
|
||||
edit(
|
||||
it.message.withContent<TextContent>() ?: it.let {
|
||||
answer(it, "Unsupported message type :(")
|
||||
return@onMessageDataCallbackQuery
|
||||
|
@ -3,15 +3,15 @@ import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
||||
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
|
||||
import dev.inmo.tgbotapi.extensions.api.send.*
|
||||
import dev.inmo.tgbotapi.extensions.api.send.media.sendDocument
|
||||
import dev.inmo.tgbotapi.extensions.api.send.media.sendDocumentsGroup
|
||||
import dev.inmo.tgbotapi.extensions.api.send.reply
|
||||
import dev.inmo.tgbotapi.extensions.api.send.withUploadDocumentAction
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviourWithLongPolling
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommandWithArgs
|
||||
import dev.inmo.tgbotapi.requests.abstracts.asMultipartFile
|
||||
import dev.inmo.tgbotapi.types.BotCommand
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
|
||||
import dev.inmo.tgbotapi.types.mediaCountInMediaGroup
|
||||
import java.io.File
|
||||
@ -81,7 +81,7 @@ suspend fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
if (!sent) {
|
||||
bot.reply(message, "Nothing selected :(")
|
||||
reply(message, "Nothing selected :(")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,19 +31,19 @@ suspend fun activateResenderBot(
|
||||
onVisualGallery {
|
||||
val chat = it.chat ?: return@onVisualGallery
|
||||
withUploadPhotoAction(chat) {
|
||||
sendVisualMediaGroup(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
}
|
||||
}
|
||||
onPlaylist {
|
||||
val chat = it.chat ?: return@onPlaylist
|
||||
withUploadDocumentAction(chat) {
|
||||
sendPlaylist(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
}
|
||||
}
|
||||
onDocumentsGroup {
|
||||
val chat = it.chat ?: return@onDocumentsGroup
|
||||
withUploadDocumentAction(chat) {
|
||||
sendDocumentsGroup(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@ suspend fun main(args: Array<String>) {
|
||||
|
||||
if (diceType == SlotMachineDiceAnimationType) {
|
||||
val result = dice.calculateSlotMachineResult() ?: return@onDice
|
||||
bot.reply(it, "${result.leftReel}|${result.centerReel}|${result.rightReel}")
|
||||
reply(it, "${result.leftReel}|${result.centerReel}|${result.rightReel}")
|
||||
} else {
|
||||
bot.reply(it, "There is no slot machine dice in message")
|
||||
reply(it, "There is no slot machine dice in message")
|
||||
}
|
||||
}
|
||||
}.join()
|
||||
|
@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx768m
|
||||
|
||||
|
||||
kotlin_version=1.6.21
|
||||
telegram_bot_api_version=2.1.0
|
||||
telegram_bot_api_version=2.1.1
|
||||
micro_utils_version=0.11.6
|
||||
serialization_version=1.3.3
|
||||
ktor_version=2.0.2
|
||||
|
Loading…
Reference in New Issue
Block a user