mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2026-09-03 22:59:03 +00:00
Compare commits
46 Commits
3.2.0
...
139de35db9
| Author | SHA1 | Date | |
|---|---|---|---|
| 139de35db9 | |||
|
|
5dd22e1da2 | ||
| 4186ab8270 | |||
| 5aa69d7990 | |||
|
|
df952c69b2 | ||
| 9a03a02bac | |||
| 0e7c050e9e | |||
|
|
bdec902b58 | ||
|
|
cc3c87590d | ||
| 910f892b89 | |||
| 8232cb4d62 | |||
| 3b26971152 | |||
| c0019bcbf8 | |||
| c3dcb4d738 | |||
| 6a9921d4bd | |||
| 33b14f320c | |||
| 50ad281132 | |||
| 6abfc3d369 | |||
| f73620afec | |||
| a3d5112c83 | |||
|
|
23abae07b7 | ||
| c5a9f657cf | |||
|
|
51f7715915 | ||
|
|
bdfb900ce3 | ||
| 27790a2576 | |||
| e722055871 | |||
| 29e1552618 | |||
| 7ef942a2b4 | |||
| fdd4dfdbcf | |||
|
|
ba88205249 | ||
| 9a38fe51f9 | |||
|
|
c172bd1fa7 | ||
| 7392e85f1b | |||
|
|
f2c7fd79d9 | ||
| 9d77b61ea3 | |||
|
|
d567b1382b | ||
| 557d4ad3ca | |||
|
|
f070fb804b | ||
| 53de520c3a | |||
| f164ba901d | |||
|
|
2a04b4979d | ||
| 4a0279c89e | |||
|
|
fcef9f1f64 | ||
|
|
33e191816a | ||
| e0b707ceba | |||
| 115c76a9d4 |
9
ChatAvatarSetter/README.md
Normal file
9
ChatAvatarSetter/README.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# ChatAvatarSetter
|
||||||
|
|
||||||
|
This bot will set the chat avatar based on the image sent to bot
|
||||||
|
|
||||||
|
## Launch
|
||||||
|
|
||||||
|
```bash
|
||||||
|
../gradlew run --args="BOT_TOKEN"
|
||||||
|
```
|
||||||
21
ChatAvatarSetter/build.gradle
Normal file
21
ChatAvatarSetter/build.gradle
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'kotlin'
|
||||||
|
apply plugin: 'application'
|
||||||
|
|
||||||
|
mainClassName="ChatAvatarSetterKt"
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|
||||||
|
implementation "dev.inmo:tgbotapi:$telegram_bot_api_version"
|
||||||
|
}
|
||||||
36
ChatAvatarSetter/src/main/kotlin/ChatAvatarSetter.kt
Normal file
36
ChatAvatarSetter/src/main/kotlin/ChatAvatarSetter.kt
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||||
|
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.chat.modify.setChatPhoto
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.files.downloadFile
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.send.reply
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviourWithLongPolling
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onPhoto
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.*
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.asMultipartFile
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
|
||||||
|
suspend fun main(args: Array<String>) {
|
||||||
|
val bot = telegramBot(args.first())
|
||||||
|
|
||||||
|
bot.buildBehaviourWithLongPolling(scope = CoroutineScope(Dispatchers.IO)) {
|
||||||
|
onPhoto {
|
||||||
|
val bytes = downloadFile(it.content)
|
||||||
|
runCatchingSafely {
|
||||||
|
setChatPhoto(
|
||||||
|
it.chat.id,
|
||||||
|
bytes.asMultipartFile("sample.jpg")
|
||||||
|
)
|
||||||
|
}.onSuccess { b ->
|
||||||
|
if (b) {
|
||||||
|
reply(it, "Done")
|
||||||
|
} else {
|
||||||
|
reply(it, "Something went wrong")
|
||||||
|
}
|
||||||
|
}.onFailure { e ->
|
||||||
|
e.printStackTrace()
|
||||||
|
|
||||||
|
reply(it, "Something went wrong (see logs)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.join()
|
||||||
|
}
|
||||||
@@ -6,16 +6,21 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams
|
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.extensions.sameThread
|
||||||
import dev.inmo.tgbotapi.extensions.utils.formatting.*
|
import dev.inmo.tgbotapi.extensions.utils.formatting.*
|
||||||
import dev.inmo.tgbotapi.types.ChatId
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
|
import dev.inmo.tgbotapi.utils.botCommand
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import kotlinx.coroutines.flow.filter
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
|
|
||||||
sealed interface BotState : State
|
sealed interface BotState : State
|
||||||
data class ExpectContentOrStopState(override val context: ChatId, val sourceMessage: CommonMessage<TextContent>) : BotState
|
data class ExpectContentOrStopState(override val context: IdChatIdentifier, val sourceMessage: CommonMessage<TextContent>) : BotState
|
||||||
data class StopState(override val context: ChatId) : BotState
|
data class StopState(override val context: IdChatIdentifier) : BotState
|
||||||
|
|
||||||
suspend fun main(args: Array<String>) {
|
suspend fun main(args: Array<String>) {
|
||||||
val botToken = args.first()
|
val botToken = args.first()
|
||||||
@@ -37,14 +42,15 @@ suspend fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
strictlyOn<ExpectContentOrStopState> {
|
strictlyOn<ExpectContentOrStopState> {
|
||||||
sendMessage(
|
send(
|
||||||
it.context,
|
it.context,
|
||||||
buildEntities {
|
) {
|
||||||
+"Send me some content or " + botCommand("stop") + " if you want to stop sending"
|
+"Send me some content or " + botCommand("stop") + " if you want to stop sending"
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
||||||
val contentMessage = waitContentMessage().first()
|
val contentMessage = waitContentMessage().filter { message ->
|
||||||
|
message.sameThread(it.sourceMessage)
|
||||||
|
}.first()
|
||||||
val content = contentMessage.content
|
val content = contentMessage.content
|
||||||
|
|
||||||
when {
|
when {
|
||||||
@@ -56,12 +62,14 @@ suspend fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
strictlyOn<StopState> {
|
strictlyOn<StopState> {
|
||||||
send(it.context, "You have stopped sending of content")
|
send(it.context) { +"You have stopped sending of content" }
|
||||||
|
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
command("start") {
|
command(
|
||||||
|
"start"
|
||||||
|
) {
|
||||||
startChain(ExpectContentOrStopState(it.chat.id, it))
|
startChain(ExpectContentOrStopState(it.chat.id, it))
|
||||||
}
|
}
|
||||||
}.second.join()
|
}.second.join()
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import dev.inmo.tgbotapi.types.chat.CommonBot
|
|||||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
import dev.inmo.tgbotapi.types.chat.ExtendedBot
|
import dev.inmo.tgbotapi.types.chat.ExtendedBot
|
||||||
import dev.inmo.tgbotapi.types.message.*
|
import dev.inmo.tgbotapi.types.message.*
|
||||||
|
import dev.inmo.tgbotapi.utils.code
|
||||||
|
import dev.inmo.tgbotapi.utils.regular
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,9 +35,10 @@ suspend fun main(vararg args: String) {
|
|||||||
regular("User ")
|
regular("User ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is CommonBot,
|
is CommonBot,
|
||||||
is ExtendedBot -> regular("Bot ")
|
is ExtendedBot -> regular("Bot ")
|
||||||
} + code(user.id.chatId.toString()) + " (${user.firstName} ${user.lastName}: ${user.username ?.username ?: "Without username"})"
|
} + code(user.id.chatId.toString()) + " (${user.firstName} ${user.lastName}: ${user.username?.username ?: "Without username"})"
|
||||||
}
|
}
|
||||||
is ForwardInfo.PublicChat.FromChannel -> regular("Channel (") + code(forwardInfo.channelChat.title) + ")"
|
is ForwardInfo.PublicChat.FromChannel -> regular("Channel (") + code(forwardInfo.channelChat.title) + ")"
|
||||||
is ForwardInfo.PublicChat.FromSupergroup -> regular("Supergroup (") + code(forwardInfo.group.title) + ")"
|
is ForwardInfo.PublicChat.FromSupergroup -> regular("Supergroup (") + code(forwardInfo.group.title) + ")"
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.chat.forum.closeForumTopic
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.chat.forum.createForumTopic
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.chat.forum.deleteForumTopic
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.chat.forum.reopenForumTopic
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviour
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviourWithLongPolling
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicClosed
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||||
|
import dev.inmo.tgbotapi.types.ForumTopic
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is one of the most easiest bot - it will just print information about itself
|
* This is one of the most easiest bot - it will just print information about itself
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ import dev.inmo.tgbotapi.extensions.api.edit.edit
|
|||||||
import dev.inmo.tgbotapi.extensions.api.send.*
|
import dev.inmo.tgbotapi.extensions.api.send.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.formatting.botCommand
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.formatting.buildEntities
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.withContent
|
import dev.inmo.tgbotapi.extensions.utils.withContent
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
|
import dev.inmo.tgbotapi.utils.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
|
||||||
private const val nextPageData = "next"
|
private const val nextPageData = "next"
|
||||||
@@ -71,13 +70,14 @@ suspend fun activateKeyboardsBot(
|
|||||||
val numberOfPages = args.firstOrNull() ?.toIntOrNull() ?: 10
|
val numberOfPages = args.firstOrNull() ?.toIntOrNull() ?: 10
|
||||||
reply(
|
reply(
|
||||||
message,
|
message,
|
||||||
"Your inline keyboard with $numberOfPages pages",
|
|
||||||
replyMarkup = inlineKeyboard {
|
replyMarkup = inlineKeyboard {
|
||||||
row {
|
row {
|
||||||
includePageButtons(1, numberOfPages)
|
includePageButtons(1, numberOfPages)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
) {
|
||||||
|
regular("Your inline keyboard with $numberOfPages pages")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageDataCallbackQuery {
|
onMessageDataCallbackQuery {
|
||||||
@@ -86,35 +86,33 @@ suspend fun activateKeyboardsBot(
|
|||||||
return@onMessageDataCallbackQuery
|
return@onMessageDataCallbackQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
val text = "This is $page of $count"
|
|
||||||
|
|
||||||
edit(
|
edit(
|
||||||
it.message.withContent<TextContent>() ?: it.let {
|
it.message.withContent<TextContent>() ?: it.let {
|
||||||
answer(it, "Unsupported message type :(")
|
answer(it, "Unsupported message type :(")
|
||||||
return@onMessageDataCallbackQuery
|
return@onMessageDataCallbackQuery
|
||||||
},
|
},
|
||||||
text,
|
|
||||||
replyMarkup = inlineKeyboard {
|
replyMarkup = inlineKeyboard {
|
||||||
row {
|
row {
|
||||||
includePageButtons(page, count)
|
includePageButtons(page, count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
) {
|
||||||
|
regular("This is $page of $count")
|
||||||
|
}
|
||||||
answer(it)
|
answer(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
onUnhandledCommand {
|
onUnhandledCommand {
|
||||||
reply(
|
reply(
|
||||||
it,
|
it,
|
||||||
buildEntities {
|
|
||||||
+"Use " + botCommand("inline") + " to get pagination inline keyboard"
|
|
||||||
},
|
|
||||||
replyMarkup = replyKeyboard(resizeKeyboard = true, oneTimeKeyboard = true) {
|
replyMarkup = replyKeyboard(resizeKeyboard = true, oneTimeKeyboard = true) {
|
||||||
row {
|
row {
|
||||||
simpleButton("/inline")
|
simpleButton("/inline")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
) {
|
||||||
|
+"Use " + botCommand("inline") + " to get pagination inline keyboard"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setMyCommands(BotCommand("inline", "Creates message with pagination inline keyboard"))
|
setMyCommands(BotCommand("inline", "Creates message with pagination inline keyboard"))
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CommonMessageFilte
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.shortcuts.*
|
import dev.inmo.tgbotapi.extensions.utils.shortcuts.*
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
|
||||||
suspend fun activateResenderBot(
|
suspend fun activateResenderBot(
|
||||||
@@ -20,33 +21,23 @@ suspend fun activateResenderBot(
|
|||||||
|
|
||||||
bot.buildBehaviourWithLongPolling(CoroutineScope(currentCoroutineContext() + SupervisorJob())) {
|
bot.buildBehaviourWithLongPolling(CoroutineScope(currentCoroutineContext() + SupervisorJob())) {
|
||||||
onContentMessage(
|
onContentMessage(
|
||||||
initialFilter = CommonMessageFilterExcludeMediaGroups,
|
subcontextUpdatesFilter = MessageFilterByChat,
|
||||||
subcontextUpdatesFilter = MessageFilterByChat
|
|
||||||
) {
|
) {
|
||||||
val chat = it.chat
|
val chat = it.chat
|
||||||
withTypingAction(chat) {
|
|
||||||
executeUnsafe(it.content.createResend(chat.id, replyToMessageId = it.messageId)) {
|
val answer = withTypingAction(chat) {
|
||||||
|
executeUnsafe(
|
||||||
|
it.content.createResend(
|
||||||
|
chat.id,
|
||||||
|
messageThreadId = it.threadIdOrNull,
|
||||||
|
replyToMessageId = it.messageId
|
||||||
|
)
|
||||||
|
) {
|
||||||
it.forEach(print)
|
it.forEach(print)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
onVisualGallery {
|
println("Answer info: $answer")
|
||||||
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() })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
||||||
|
|||||||
@@ -2,28 +2,32 @@ import dev.inmo.micro_utils.coroutines.defaultSafelyWithoutExceptionHandler
|
|||||||
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||||
import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
||||||
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.api.get.getCustomEmojiStickerOrNull
|
import dev.inmo.tgbotapi.extensions.api.get.*
|
||||||
import dev.inmo.tgbotapi.extensions.api.get.getStickerSet
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.*
|
import dev.inmo.tgbotapi.extensions.api.send.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.formatting.*
|
|
||||||
import dev.inmo.tgbotapi.types.StickerType
|
import dev.inmo.tgbotapi.types.StickerType
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.*
|
import dev.inmo.tgbotapi.types.message.textsources.*
|
||||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||||
|
import dev.inmo.tgbotapi.utils.bold
|
||||||
|
import dev.inmo.tgbotapi.utils.buildEntities
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
|
||||||
fun StickerSet.buildInfo() = buildEntities {
|
fun StickerSet?.buildInfo() = buildEntities {
|
||||||
bold("StickerSet name: ") + "${name}\n"
|
if (this@buildInfo == null) {
|
||||||
bold("StickerSet title: ") + "${title}\n"
|
bold("Looks like this stickerset has been removed")
|
||||||
bold(
|
} else {
|
||||||
when (stickerType) {
|
bold("StickerSet name: ") + "${name}\n"
|
||||||
StickerType.CustomEmoji -> "Custom emoji"
|
bold("StickerSet title: ") + "${title}\n"
|
||||||
StickerType.Mask -> "Mask"
|
bold(
|
||||||
StickerType.Regular -> "Regular"
|
when (stickerType) {
|
||||||
is StickerType.Unknown -> "Unknown type \"${stickerType.type}\""
|
StickerType.CustomEmoji -> "Custom emoji"
|
||||||
}
|
StickerType.Mask -> "Mask"
|
||||||
) + " sticker set with title " + bold(title) + " and name " + bold(name)
|
StickerType.Regular -> "Regular"
|
||||||
|
is StickerType.Unknown -> "Unknown type \"${stickerType.type}\""
|
||||||
|
}
|
||||||
|
) + " sticker set with title " + bold(title) + " and name " + bold(name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun activateStickerInfoBot(
|
suspend fun activateStickerInfoBot(
|
||||||
@@ -57,7 +61,7 @@ suspend fun activateStickerInfoBot(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onSticker {
|
onSticker {
|
||||||
val stickerSetInfo = getStickerSet(it.content.media)
|
val stickerSetInfo = getStickerSetOrNull(it.content.media)
|
||||||
reply(
|
reply(
|
||||||
it,
|
it,
|
||||||
stickerSetInfo.buildInfo()
|
stickerSetInfo.buildInfo()
|
||||||
|
|||||||
@@ -7,16 +7,13 @@ import dev.inmo.tgbotapi.extensions.api.send.*
|
|||||||
import dev.inmo.tgbotapi.extensions.api.telegramBot
|
import dev.inmo.tgbotapi.extensions.api.telegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.formatting.botCommand
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.formatting.buildEntities
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputTextMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputTextMessageContent
|
||||||
import dev.inmo.tgbotapi.types.webAppQueryIdField
|
import dev.inmo.tgbotapi.types.webAppQueryIdField
|
||||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||||
import dev.inmo.tgbotapi.utils.PreviewFeature
|
import dev.inmo.tgbotapi.utils.*
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.call
|
import io.ktor.server.application.call
|
||||||
import io.ktor.server.http.content.*
|
import io.ktor.server.http.content.*
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ org.gradle.parallel=true
|
|||||||
org.gradle.jvmargs=-Xmx768m
|
org.gradle.jvmargs=-Xmx768m
|
||||||
|
|
||||||
|
|
||||||
kotlin_version=1.7.10
|
kotlin_version=1.7.21
|
||||||
telegram_bot_api_version=3.2.0
|
telegram_bot_api_version=4.1.0
|
||||||
micro_utils_version=0.12.4
|
micro_utils_version=0.14.2
|
||||||
serialization_version=1.4.0
|
serialization_version=1.4.1
|
||||||
ktor_version=2.1.0
|
ktor_version=2.1.3
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ include ":StickerInfoBot:jvm_launcher"
|
|||||||
|
|
||||||
include ":SlotMachineDetectorBot"
|
include ":SlotMachineDetectorBot"
|
||||||
|
|
||||||
|
include ":ChatAvatarSetter"
|
||||||
|
|
||||||
include ":WebApp"
|
include ":WebApp"
|
||||||
|
|
||||||
include ":FSMBot"
|
include ":FSMBot"
|
||||||
|
|||||||
Reference in New Issue
Block a user