mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 08:37:12 +00:00
commit
741d808db2
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,5 +1,22 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 7.0.0
|
||||
|
||||
This update contains support of [Telegram Bot API 6.6](https://core.telegram.org/bots/api-changelog#march-9-2023)
|
||||
|
||||
**THIS VERSION CONTAINS BREAKING CHANGES**:
|
||||
|
||||
* All previous deprecations have been removed
|
||||
* Fully reworked mechanism of stickers creating and adding
|
||||
* All separations of stickers types like `Animeted` have been replaces with type `StickerFormat`
|
||||
* New `InputSticker` type (and all subtypes) as replacements for old raw fields in methods
|
||||
* Reworked mechanism of files uploading
|
||||
|
||||
Other changes
|
||||
|
||||
* `Versions`:
|
||||
* `MicroUtils`: `0.17.3` -> `0.17.5`
|
||||
|
||||
## 6.1.0
|
||||
|
||||
* `Versions`:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-6.5-blue)](https://core.telegram.org/bots/api-changelog#february-3-2023)
|
||||
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-6.6-blue)](https://core.telegram.org/bots/api-changelog#march-9-2023)
|
||||
|
||||
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Bookstack&message=Tutorial&color=blue&logo=bookstack)](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||
|:---:|:---:|
|
||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=6.1.0
|
||||
library_version=7.0.0
|
||||
|
@ -13,7 +13,7 @@ ktor = "2.2.4"
|
||||
ksp = "1.8.10-1.0.9"
|
||||
kotlin-poet = "1.12.0"
|
||||
|
||||
microutils = "0.17.3"
|
||||
microutils = "0.17.5"
|
||||
|
||||
github-release-plugin = "2.4.1"
|
||||
dokka = "1.8.10"
|
||||
@ -45,6 +45,7 @@ microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.re
|
||||
microutils-serialization-base64 = { module = "dev.inmo:micro_utils.serialization.base64", version.ref = "microutils" }
|
||||
microutils-serialization-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
|
||||
microutils-serialization-typedSerializer = { module = "dev.inmo:micro_utils.serialization.typed_serializer", version.ref = "microutils" }
|
||||
microutils-serialization-mapper = { module = "dev.inmo:micro_utils.serialization.mapper", version.ref = "microutils" }
|
||||
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
|
||||
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
|
||||
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
||||
|
@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyDescription(
|
||||
languageCode: IetfLanguageCode? = null
|
||||
) = execute(GetMyDescription(languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyDescription(
|
||||
languageCode: String?
|
||||
) = getMyDescription(languageCode ?.let(::IetfLanguageCode))
|
@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyShortDescription(
|
||||
languageCode: IetfLanguageCode? = null
|
||||
) = execute(GetMyShortDescription(languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyShortDescription(
|
||||
languageCode: String?
|
||||
) = getMyShortDescription(languageCode ?.let(::IetfLanguageCode))
|
@ -0,0 +1,19 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyDescription
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.setMyDescription(
|
||||
description: String? = null,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
) = execute(SetMyDescription(description, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyDescription(
|
||||
description: String?,
|
||||
languageCode: String?
|
||||
) = setMyDescription(description, languageCode ?.let(::IetfLanguageCode))
|
@ -0,0 +1,15 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
||||
|
||||
suspend fun TelegramBot.setMyShortDescription(
|
||||
shortDescription: String? = null,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
) = execute(SetMyShortDescription(shortDescription, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyShortDescription(
|
||||
shortDescription: String?,
|
||||
languageCode: String?
|
||||
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLanguageCode))
|
@ -10,13 +10,6 @@ suspend fun TelegramBot.getStickerSet(
|
||||
GetStickerSet(name)
|
||||
)
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("getStickerSetOrThrow(sticker)", "dev.inmo.tgbotapi.extensions.api.get.getStickerSetOrThrow"))
|
||||
suspend fun TelegramBot.getStickerSet(
|
||||
sticker: Sticker
|
||||
) = getStickerSet(
|
||||
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.getStickerSetOrNull(
|
||||
sticker: Sticker
|
||||
) = sticker.stickerSetName ?.let {
|
||||
|
@ -685,20 +685,22 @@ suspend inline fun TelegramBot.reply(
|
||||
suspend inline fun TelegramBot.replyWithSticker(
|
||||
to: Message,
|
||||
sticker: InputFile,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(to.chat, sticker, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
to: Message,
|
||||
sticker: Sticker,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(to.chat, sticker, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
|
||||
// Videos
|
||||
|
@ -761,22 +761,24 @@ suspend inline fun TelegramBot.replyWithSticker(
|
||||
toMessageId: MessageId,
|
||||
sticker: InputFile,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(toChatId, sticker, threadId, disableNotification, protectContent, toMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(toChatId, sticker, threadId, emoji, disableNotification, protectContent, toMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
suspend inline fun TelegramBot.reply(
|
||||
toChatId: IdChatIdentifier,
|
||||
toMessageId: MessageId,
|
||||
sticker: Sticker,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(toChatId, sticker, threadId, disableNotification, protectContent, toMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(toChatId, sticker, threadId, emoji, disableNotification, protectContent, toMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
|
||||
// Videos
|
||||
|
@ -1111,12 +1111,13 @@ suspend fun TelegramBot.send(
|
||||
chatId: ChatIdentifier,
|
||||
sticker: Sticker,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(chatId, sticker, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* Will execute [sendSticker] request
|
||||
@ -1127,12 +1128,13 @@ suspend fun TelegramBot.send(
|
||||
chat: Chat,
|
||||
sticker: Sticker,
|
||||
threadId: MessageThreadId? = chat.id.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(chat, sticker, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(chat, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ suspend fun TelegramBot.sendAnimation(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendAnimation(
|
||||
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
|
||||
/**
|
||||
@ -177,7 +177,7 @@ suspend fun TelegramBot.sendAnimation(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendAnimation(
|
||||
chatId, animation.fileId, animation.thumb ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ suspend fun TelegramBot.sendAudio(
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -180,7 +180,7 @@ suspend inline fun TelegramBot.sendAudio(
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
|
@ -83,7 +83,7 @@ suspend fun TelegramBot.sendDocument(
|
||||
replyMarkup: KeyboardMarkup? = null,
|
||||
disableContentTypeDetection: Boolean? = null
|
||||
) = sendDocument(
|
||||
chatId, document.fileId, document.thumb ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
||||
chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
||||
)
|
||||
|
||||
/**
|
||||
@ -170,7 +170,7 @@ suspend inline fun TelegramBot.sendDocument(
|
||||
replyMarkup: KeyboardMarkup? = null,
|
||||
disableContentTypeDetection: Boolean? = null
|
||||
) = sendDocument(
|
||||
chatId, document.fileId, document.thumb ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
||||
chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -19,13 +19,14 @@ suspend fun TelegramBot.sendSticker(
|
||||
chatId: ChatIdentifier,
|
||||
sticker: InputFile,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendSticker(chatId, sticker, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
SendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
)
|
||||
|
||||
/**
|
||||
@ -36,12 +37,13 @@ suspend fun TelegramBot.sendSticker(
|
||||
chat: Chat,
|
||||
sticker: InputFile,
|
||||
threadId: MessageThreadId? = chat.id.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(chat.id, sticker, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(chat.id, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -51,12 +53,13 @@ suspend fun TelegramBot.sendSticker(
|
||||
chatId: ChatIdentifier,
|
||||
sticker: Sticker,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(chatId, sticker.fileId, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(chatId, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -66,9 +69,10 @@ suspend fun TelegramBot.sendSticker(
|
||||
chat: Chat,
|
||||
sticker: Sticker,
|
||||
threadId: MessageThreadId? = chat.id.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendSticker(chat, sticker.fileId, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendSticker(chat, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
@ -70,7 +70,7 @@ suspend fun TelegramBot.sendVideo(
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
@ -167,7 +167,7 @@ suspend inline fun TelegramBot.sendVideo(
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
|
@ -57,7 +57,7 @@ suspend fun TelegramBot.sendVideoNote(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVideoNote(
|
||||
chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -1,90 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddAnimatedStickerToSet
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
AddAnimatedStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
AddAnimatedStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSetName: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addAnimatedStickerToSet(
|
||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSetName: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addAnimatedStickerToSet(
|
||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addAnimatedStickerToSet(
|
||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addAnimatedStickerToSet(
|
||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addAnimatedStickerToSet(
|
||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addAnimatedStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addAnimatedStickerToSet(
|
||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
@ -1,90 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddStaticStickerToSet
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
AddStaticStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
AddStaticStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSetName: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStaticStickerToSet(
|
||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSetName: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStaticStickerToSet(
|
||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStaticStickerToSet(
|
||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStaticStickerToSet(
|
||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStaticStickerToSet(
|
||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStaticStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStaticStickerToSet(
|
||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
@ -0,0 +1,116 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
inputSticker: InputSticker
|
||||
) = execute(
|
||||
AddStickerToSet(userId, stickerSetName, inputSticker)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputSticker
|
||||
) = addStickerToSet(
|
||||
userId,
|
||||
stickerSet.name,
|
||||
sticker
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
emojis: List<String>,
|
||||
keywords: List<String> = emptyList()
|
||||
) = addStickerToSet(
|
||||
userId,
|
||||
stickerSet,
|
||||
when (stickerSet.stickerType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
sticker,
|
||||
emojis,
|
||||
keywords
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
sticker,
|
||||
emojis
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
sticker,
|
||||
emojis,
|
||||
keywords
|
||||
)
|
||||
is StickerType.Unknown -> error("Unable to create sticker to the set with type ${stickerSet.stickerType}")
|
||||
}
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
emojis: List<String>,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStickerToSet(
|
||||
userId,
|
||||
stickerSet.name,
|
||||
when (stickerSet.stickerType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
sticker,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
sticker,
|
||||
emojis,
|
||||
maskPosition
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
sticker,
|
||||
emojis,
|
||||
emptyList()
|
||||
)
|
||||
is StickerType.Unknown -> error("Unable to create sticker to the set with type ${stickerSet.stickerType}")
|
||||
}
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputSticker
|
||||
) = addStickerToSet(
|
||||
user.id,
|
||||
stickerSet.name,
|
||||
sticker
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
emojis: List<String>,
|
||||
keywords: List<String> = emptyList()
|
||||
) = addStickerToSet(
|
||||
user.id, stickerSet, sticker, emojis, keywords
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: InputFile,
|
||||
emojis: List<String>,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addStickerToSet(
|
||||
user.id, stickerSet, sticker, emojis, maskPosition
|
||||
)
|
@ -1,90 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddVideoStickerToSet
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
AddVideoStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
AddVideoStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSetName: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addVideoStickerToSet(
|
||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSetName: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addVideoStickerToSet(
|
||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addVideoStickerToSet(
|
||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addVideoStickerToSet(
|
||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addVideoStickerToSet(
|
||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addVideoStickerToSet(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = addVideoStickerToSet(
|
||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||
)
|
@ -1,58 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.CreateNewAnimatedStickerSet
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewAnimatedStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewAnimatedStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewAnimatedStickerSet(
|
||||
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewAnimatedStickerSet(
|
||||
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
@ -1,54 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewMaskAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
CreateNewMaskAnimatedStickerSet(userId, name, title, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewMaskAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
CreateNewMaskAnimatedStickerSet(userId, name, title, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewMaskAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = createNewMaskAnimatedStickerSet(
|
||||
user.id, name, title, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewMaskAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = createNewMaskAnimatedStickerSet(
|
||||
user.id, name, title, sticker, emojis, maskPosition
|
||||
)
|
@ -1,54 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewMaskStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
CreateNewMaskStickerSet(userId, name, title, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewMaskStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
CreateNewMaskStickerSet(userId, name, title, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewMaskStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = createNewMaskStickerSet(
|
||||
user.id, name, title, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewMaskStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = createNewMaskStickerSet(
|
||||
user.id, name, title, sticker, emojis, maskPosition
|
||||
)
|
@ -1,54 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewMaskVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
CreateNewMaskVideoStickerSet(userId, name, title, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewMaskVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
CreateNewMaskVideoStickerSet(userId, name, title, sticker, emojis, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewMaskVideoStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = createNewMaskVideoStickerSet(
|
||||
user.id, name, title, sticker, emojis, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewMaskVideoStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
) = createNewMaskVideoStickerSet(
|
||||
user.id, name, title, sticker, emojis, maskPosition
|
||||
)
|
@ -1,50 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewRegularAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String
|
||||
) = execute(
|
||||
CreateNewRegularAnimatedStickerSet(userId, name, title, sticker, emojis)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewRegularAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String
|
||||
) = execute(
|
||||
CreateNewRegularAnimatedStickerSet(userId, name, title, sticker, emojis)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewRegularAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String
|
||||
) = createNewRegularAnimatedStickerSet(
|
||||
user.id, name, title, sticker, emojis
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewRegularAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String
|
||||
) = createNewRegularAnimatedStickerSet(
|
||||
user.id, name, title, sticker, emojis
|
||||
)
|
@ -1,50 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewRegularStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String
|
||||
) = execute(
|
||||
CreateNewRegularStickerSet(userId, name, title, sticker, emojis)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewRegularStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String
|
||||
) = execute(
|
||||
CreateNewRegularStickerSet(userId, name, title, sticker, emojis)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewRegularStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String
|
||||
) = createNewRegularStickerSet(
|
||||
user.id, name, title, sticker, emojis
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewRegularStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String
|
||||
) = createNewRegularStickerSet(
|
||||
user.id, name, title, sticker, emojis
|
||||
)
|
@ -1,50 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewRegularVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String
|
||||
) = execute(
|
||||
CreateNewRegularVideoStickerSet(userId, name, title, sticker, emojis)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewRegularVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String
|
||||
) = execute(
|
||||
CreateNewRegularVideoStickerSet(userId, name, title, sticker, emojis)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewRegularVideoStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String
|
||||
) = createNewRegularVideoStickerSet(
|
||||
user.id, name, title, sticker, emojis
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewRegularVideoStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String
|
||||
) = createNewRegularVideoStickerSet(
|
||||
user.id, name, title, sticker, emojis
|
||||
)
|
@ -1,58 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.CreateNewStaticStickerSet
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewStaticStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewStaticStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewStaticStickerSet(
|
||||
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewStaticStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewStaticStickerSet(
|
||||
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
@ -0,0 +1,31 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.stickers.CreateNewStickerSet
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.types.StickerFormat
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
|
||||
suspend fun TelegramBot.createNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean = false
|
||||
) = execute(
|
||||
CreateNewStickerSet(userId, name, title, stickersFormat, stickers, needsRepainting)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean = false,
|
||||
) = createNewStickerSet(
|
||||
user.id, name, title, stickersFormat, stickers, needsRepainting
|
||||
)
|
@ -1,58 +0,0 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.CreateNewVideoStickerSet
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewVideoStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewVideoStickerSet(userId, name, title, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewVideoStickerSet(
|
||||
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createNewVideoStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewVideoStickerSet(
|
||||
user.id, name, title, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
@ -0,0 +1,25 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
||||
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerSet
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.deleteStickerSet(
|
||||
name: StickerSetName
|
||||
) = execute(
|
||||
DeleteStickerSet(name)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteStickerSet(
|
||||
sticker: Sticker
|
||||
) = deleteStickerSet(
|
||||
sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker")
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteStickerSet(
|
||||
stickerSet: StickerSet,
|
||||
) = deleteStickerSet(stickerSet.name)
|
@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.thumbs
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetCustomEmojiStickerSetThumbnail
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail
|
||||
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail(
|
||||
stickerSetName: StickerSetName,
|
||||
customEmojiId: CustomEmojiId
|
||||
) = execute(
|
||||
SetCustomEmojiStickerSetThumbnail(stickerSetName, customEmojiId)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail(
|
||||
stickerSet: StickerSet,
|
||||
customEmojiId: CustomEmojiId
|
||||
) = setCustomEmojiStickerSetThumbnail(
|
||||
stickerSet.name, customEmojiId
|
||||
)
|
@ -0,0 +1,25 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerEmojiList
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
|
||||
suspend fun TelegramBot.setStickerEmojiList(
|
||||
sticker: FileId,
|
||||
emojis: List<String>
|
||||
) = execute(
|
||||
SetStickerEmojiList(
|
||||
sticker,
|
||||
emojis
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerEmojiList(
|
||||
sticker: Sticker,
|
||||
vararg emojis: String
|
||||
) = setStickerEmojiList(
|
||||
sticker.fileId,
|
||||
emojis.toList()
|
||||
)
|
@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerEmojiList
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerKeywords
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
|
||||
suspend fun TelegramBot.setStickerKeywords(
|
||||
sticker: FileId,
|
||||
keywords: List<String>
|
||||
) = execute(
|
||||
SetStickerKeywords(
|
||||
sticker,
|
||||
keywords
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerKeywords(
|
||||
sticker: Sticker,
|
||||
vararg keywords: String
|
||||
) = setStickerKeywords(
|
||||
sticker.fileId,
|
||||
keywords.toList()
|
||||
)
|
@ -0,0 +1,19 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerEmojiList
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerMaskPosition
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
suspend fun TelegramBot.setStickerMaskPosition(
|
||||
sticker: FileId,
|
||||
maskPosition: MaskPosition
|
||||
) = execute(
|
||||
SetStickerMaskPosition(
|
||||
sticker,
|
||||
maskPosition
|
||||
)
|
||||
)
|
@ -3,27 +3,95 @@ package dev.inmo.tgbotapi.extensions.api.thumbs
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumb
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
thumbnail: FileId
|
||||
) = execute(
|
||||
SetStickerSetThumbnail(userId, stickerSetName, thumbnail)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: StickerSetName,
|
||||
thumbnail: MultipartFile
|
||||
) = execute(
|
||||
SetStickerSetThumbnail(userId, stickerSetName, thumbnail)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSetName: StickerSetName,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSetName, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSetName: StickerSetName,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSetName, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
userId, stickerSet.name, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
userId, stickerSet.name, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSet.name, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
user: CommonUser,
|
||||
stickerSet: StickerSet,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSet.name, thumbnail
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSetName: String,
|
||||
thumb: FileId
|
||||
) = execute(
|
||||
SetStickerSetThumb(userId, thumbSetName, thumb)
|
||||
SetStickerSetThumbnail(userId, thumbSetName, thumb)
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSetName: String,
|
||||
thumb: MultipartFile
|
||||
) = execute(
|
||||
SetStickerSetThumb(userId, thumbSetName, thumb)
|
||||
SetStickerSetThumbnail(userId, thumbSetName, thumb)
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSetName: String,
|
||||
@ -32,6 +100,7 @@ suspend fun TelegramBot.setStickerSetThumb(
|
||||
user.id, thumbSetName, thumb
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSetName: String,
|
||||
@ -40,6 +109,7 @@ suspend fun TelegramBot.setStickerSetThumb(
|
||||
user.id, thumbSetName, thumb
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSet: StickerSet,
|
||||
@ -48,6 +118,7 @@ suspend fun TelegramBot.setStickerSetThumb(
|
||||
userId, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSet: StickerSet,
|
||||
@ -56,6 +127,7 @@ suspend fun TelegramBot.setStickerSetThumb(
|
||||
userId, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSet: StickerSet,
|
||||
@ -64,6 +136,7 @@ suspend fun TelegramBot.setStickerSetThumb(
|
||||
user.id, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
||||
suspend fun TelegramBot.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSet: StickerSet,
|
||||
|
@ -0,0 +1,22 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerSetTitle
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.setStickerSetTitle(
|
||||
name: StickerSetName,
|
||||
title: String
|
||||
) = execute(SetStickerSetTitle(name, title))
|
||||
|
||||
suspend fun TelegramBot.setStickerSetTitle(
|
||||
sticker: Sticker,
|
||||
title: String
|
||||
) = setStickerSetTitle(sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker"), title)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetTitle(
|
||||
stickerSet: StickerSet,
|
||||
title: String
|
||||
) = setStickerSetTitle(stickerSet.name, title)
|
@ -3,19 +3,22 @@ package dev.inmo.tgbotapi.extensions.api.stickers
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.UploadStickerFile
|
||||
import dev.inmo.tgbotapi.types.StickerFormat
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
|
||||
suspend fun TelegramBot.uploadStickerFile(
|
||||
userId: UserId,
|
||||
sticker: MultipartFile
|
||||
sticker: MultipartFile,
|
||||
stickerFormat: StickerFormat
|
||||
) = execute(
|
||||
UploadStickerFile(userId, sticker)
|
||||
UploadStickerFile(userId, sticker, stickerFormat)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.uploadStickerFile(
|
||||
user: CommonUser,
|
||||
sticker: MultipartFile
|
||||
sticker: MultipartFile,
|
||||
stickerFormat: StickerFormat
|
||||
) = execute(
|
||||
UploadStickerFile(user.id, sticker)
|
||||
UploadStickerFile(user.id, sticker, stickerFormat)
|
||||
)
|
||||
|
@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||
import io.ktor.util.cio.use
|
||||
import io.ktor.util.cio.writeChannel
|
||||
import io.ktor.utils.io.copyAndClose
|
||||
import io.ktor.utils.io.copyTo
|
||||
import kotlinx.coroutines.job
|
||||
import java.io.File
|
||||
@ -25,7 +26,7 @@ suspend fun TelegramBot.downloadFile(
|
||||
doOutsideOfCoroutine { destFile.createNewFile() }
|
||||
|
||||
destFile.writeChannel(coroutineContext.job).use {
|
||||
readChannel.copyTo(this)
|
||||
readChannel.copyAndClose(this)
|
||||
}
|
||||
|
||||
return destFile
|
||||
|
@ -30,11 +30,17 @@ suspend fun TelegramBot.downloadFileToTemp(
|
||||
|
||||
suspend fun TelegramBot.downloadFileToTemp(
|
||||
pathedFile: PathedFile
|
||||
) = downloadFileToTemp(
|
||||
): File = downloadFileToTemp(
|
||||
pathedFile.filePath
|
||||
).apply {
|
||||
runCatching {
|
||||
renameTo(File(parentFile, "$nameWithoutExtension.${pathedFile.fileName.fileExtension}"))
|
||||
).run {
|
||||
val newFile = File(parentFile, "$nameWithoutExtension.${pathedFile.fileName.fileExtension}")
|
||||
val success = runCatching {
|
||||
renameTo(newFile)
|
||||
}.getOrElse { false }
|
||||
if (success) {
|
||||
newFile
|
||||
} else {
|
||||
this@run
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,6 @@ suspend inline fun <reified O : MessageContent> BehaviourContext.waitContent(
|
||||
): Flow<O> = waitContentMessage<O>(initRequest, errorFactory).map { it.content }
|
||||
|
||||
|
||||
@Deprecated(
|
||||
includeMediaGroupsDeprecationMessage,
|
||||
ReplaceWith("waitAnyContent(initRequest, errorFactory)", "dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitAnyContent")
|
||||
)
|
||||
suspend fun BehaviourContext.waitContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<MessageContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAnyContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
@ -69,62 +60,26 @@ suspend fun BehaviourContext.waitVenue(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent<VenueContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitAudioMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAudioMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
) = waitContent<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitDocumentMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitDocumentMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitMedia(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<MediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitMedia(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent<MediaContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitAnyMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<MediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAnyMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
) = waitContent<MediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitVisualMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitVisualMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitTextedMediaContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<TextedMediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitTextedMediaContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
@ -133,32 +88,14 @@ suspend fun BehaviourContext.waitAnimation(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent<AnimationContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitAudio(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<AudioContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAudio(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
) = waitContent<AudioContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitDocument(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<DocumentContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitDocument(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
) = waitContent<DocumentContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitPhoto(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<PhotoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitPhoto(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
@ -167,12 +104,6 @@ suspend fun BehaviourContext.waitSticker(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContent<StickerContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitVideo(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContent<VideoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitVideo(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
|
@ -13,7 +13,6 @@ import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
const val includeMediaGroupsDeprecationMessage = "includeMediaGroups is deprecated and its usage will not lead to any changes"
|
||||
typealias CommonMessageToCommonMessageMapper<T> = suspend CommonMessage<T>.() -> CommonMessage<T>?
|
||||
|
||||
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||
@ -47,15 +46,6 @@ internal inline fun <reified T : MessageContent> contentMessageConverter(
|
||||
if (content is T) this as CommonMessage<T> else null
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
includeMediaGroupsDeprecationMessage,
|
||||
ReplaceWith("waitAnyContentMessage(initRequest, errorFactory)", "dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitAnyContentMessage")
|
||||
)
|
||||
suspend fun BehaviourContext.waitContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<MessageContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAnyContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
@ -96,62 +86,26 @@ suspend fun BehaviourContext.waitVenueMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<VenueContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitAudioMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAudioMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitDocumentMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitDocumentMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitMediaMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<MediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitMediaMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<MediaContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitAnyMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<MediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAnyMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<MediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitVisualMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitVisualMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitTextedMediaContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<TextedMediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitTextedMediaContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
@ -160,32 +114,14 @@ suspend fun BehaviourContext.waitAnimationMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<AnimationContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitAudioMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<AudioContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitAudioMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<AudioContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitDocumentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<DocumentContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitDocumentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<DocumentContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitPhotoMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<PhotoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitPhotoMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
@ -194,12 +130,6 @@ suspend fun BehaviourContext.waitStickerMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitContentMessage<StickerContent>(initRequest, errorFactory)
|
||||
@Deprecated(includeMediaGroupsDeprecationMessage)
|
||||
suspend fun BehaviourContext.waitVideoMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean
|
||||
) = waitContentMessage<VideoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitVideoMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
|
@ -109,7 +109,7 @@ suspend fun BehaviourContext.waitGroupChatCreatedEvents(
|
||||
suspend fun BehaviourContext.waitLeftChatMemberEvents(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEvents<LeftChatMember>(initRequest, errorFactory)
|
||||
) = waitEvents<LeftChatMemberEvent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitNewChatPhotoEvents(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
|
@ -106,7 +106,7 @@ suspend fun BehaviourContext.waitGroupChatCreatedEventsMessages(
|
||||
suspend fun BehaviourContext.waitLeftChatMemberEventsMessages(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEventsMessages<LeftChatMember>(initRequest, errorFactory)
|
||||
) = waitEventsMessages<LeftChatMemberEvent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitNewChatPhotoEventsMessages(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
|
@ -346,10 +346,10 @@ suspend fun <BC : BehaviourContext> BC.onGroupChatCreated(
|
||||
* data
|
||||
*/
|
||||
suspend fun <BC : BehaviourContext> BC.onLeftChatMember(
|
||||
initialFilter: SimpleFilter<ChatEventMessage<LeftChatMember>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<LeftChatMember>, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<LeftChatMember>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<LeftChatMember>>
|
||||
initialFilter: SimpleFilter<ChatEventMessage<LeftChatMemberEvent>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<LeftChatMemberEvent>, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<LeftChatMemberEvent>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<LeftChatMemberEvent>>
|
||||
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,7 @@ kotlin {
|
||||
api libs.microutils.serialization.base64
|
||||
api libs.microutils.serialization.encapsulator
|
||||
api libs.microutils.serialization.typedSerializer
|
||||
api libs.microutils.serialization.mapper
|
||||
api libs.microutils.ktor.common
|
||||
api libs.microutils.languageCodes
|
||||
|
||||
|
@ -36,8 +36,10 @@ sealed class InputFile {
|
||||
}
|
||||
}
|
||||
|
||||
internal const val attachPrefix = "attach://"
|
||||
|
||||
internal inline val InputFile.attachFileId
|
||||
get() = "attach://$fileId"
|
||||
get() = "$attachPrefix$fileId"
|
||||
internal inline val InputFile.fileIdToSend
|
||||
get() = when (this) {
|
||||
is FileId -> fileId
|
||||
@ -60,8 +62,8 @@ fun String.toInputFile() = FileId(this)
|
||||
@RiskFeature
|
||||
object InputFileSerializer : KSerializer<InputFile> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(FileId::class.toString(), PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId)
|
||||
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
|
||||
override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileIdToSend)
|
||||
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString().removePrefix(attachPrefix))
|
||||
}
|
||||
|
||||
// TODO:: add checks for files size
|
||||
|
@ -0,0 +1,23 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
class GetMyDescription(
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : SimpleRequest<BotDescription>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "getMyDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<BotDescription>
|
||||
get() = BotDescription.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
class GetMyShortDescription(
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : SimpleRequest<BotShortDescription>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "getMyShortDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<BotShortDescription>
|
||||
get() = BotShortDescription.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
class SetMyDescription(
|
||||
@SerialName(descriptionField)
|
||||
val description: String? = null,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "setMyDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
class SetMyShortDescription(
|
||||
@SerialName(shortDescriptionField)
|
||||
val shortDescription: String? = null,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||
override fun method(): String = "setMyShortDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
package dev.inmo.tgbotapi.requests.send.abstracts
|
||||
|
||||
interface ThumbedSendMessageRequest<T: Any>: SendMessageRequest<T> {
|
||||
val thumbnail: String?
|
||||
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnail"))
|
||||
val thumb: String?
|
||||
}
|
||||
get() = thumbnail
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -22,7 +23,7 @@ import kotlinx.serialization.*
|
||||
fun SendAnimation(
|
||||
chatId: ChatIdentifier,
|
||||
animation: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
spoilered: Boolean = false,
|
||||
@ -36,15 +37,13 @@ fun SendAnimation(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<AnimationContent>> {
|
||||
val animationAsFileId = (animation as? FileId) ?.fileId
|
||||
val animationAsFile = animation as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendAnimationData(
|
||||
chatId,
|
||||
animationAsFileId,
|
||||
thumbAsFileId,
|
||||
animation,
|
||||
thumbnail ?.fileId,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
@ -63,9 +62,9 @@ fun SendAnimation(
|
||||
return if (animationAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendAnimationFiles(animationAsFile, thumbAsFile)
|
||||
listOfNotNull(animationAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -73,7 +72,7 @@ fun SendAnimation(
|
||||
fun SendAnimation(
|
||||
chatId: ChatIdentifier,
|
||||
animation: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
duration: Long? = null,
|
||||
@ -86,15 +85,13 @@ fun SendAnimation(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<AnimationContent>> {
|
||||
val animationAsFileId = (animation as? FileId) ?.fileId
|
||||
val animationAsFile = animation as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendAnimationData(
|
||||
chatId,
|
||||
animationAsFileId,
|
||||
thumbAsFileId,
|
||||
animation,
|
||||
thumbnail ?.fileId,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
@ -113,9 +110,9 @@ fun SendAnimation(
|
||||
return if (animationAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendAnimationFiles(animationAsFile, thumbAsFile)
|
||||
listOfNotNull(animationAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -128,9 +125,9 @@ data class SendAnimationData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(animationField)
|
||||
val animation: String? = null,
|
||||
@SerialName(thumbField)
|
||||
override val thumb: String? = null,
|
||||
val animation: InputFile,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: String? = null,
|
||||
@SerialName(captionField)
|
||||
override val text: String? = null,
|
||||
@SerialName(parseModeField)
|
||||
@ -187,8 +184,8 @@ data class SendAnimationData internal constructor(
|
||||
|
||||
data class SendAnimationFiles internal constructor(
|
||||
val animation: MultipartFile? = null,
|
||||
val thumb: MultipartFile? = null
|
||||
val thumbnail: MultipartFile? = null
|
||||
) : Files by mapOfNotNull(
|
||||
animationField to animation,
|
||||
thumbField to thumb
|
||||
thumbnailField to thumbnail
|
||||
)
|
||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.Performerable
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -23,7 +24,7 @@ import kotlinx.serialization.*
|
||||
fun SendAudio(
|
||||
chatId: ChatIdentifier,
|
||||
audio: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
@ -36,15 +37,13 @@ fun SendAudio(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<AudioContent>> {
|
||||
val audioAsFileId = (audio as? FileId) ?.fileId
|
||||
val audioAsFile = audio as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendAudioData(
|
||||
chatId,
|
||||
audioAsFileId,
|
||||
thumbAsFileId,
|
||||
audio,
|
||||
thumbnail ?.fileId,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
@ -62,9 +61,9 @@ fun SendAudio(
|
||||
return if (audioAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendAudioFiles(audioAsFile, thumbAsFile)
|
||||
listOfNotNull(audioAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -72,7 +71,7 @@ fun SendAudio(
|
||||
fun SendAudio(
|
||||
chatId: ChatIdentifier,
|
||||
audio: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
entities: List<TextSource>,
|
||||
duration: Long? = null,
|
||||
performer: String? = null,
|
||||
@ -84,15 +83,13 @@ fun SendAudio(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<AudioContent>> {
|
||||
val audioAsFileId = (audio as? FileId) ?.fileId
|
||||
val audioAsFile = audio as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendAudioData(
|
||||
chatId,
|
||||
audioAsFileId,
|
||||
thumbAsFileId,
|
||||
audio,
|
||||
thumbnail ?.fileId,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
@ -110,9 +107,9 @@ fun SendAudio(
|
||||
return if (audioAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendAudioFiles(audioAsFile, thumbAsFile)
|
||||
listOfNotNull(audioAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -125,9 +122,9 @@ data class SendAudioData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(audioField)
|
||||
val audio: String? = null,
|
||||
@SerialName(thumbField)
|
||||
override val thumb: String? = null,
|
||||
val audio: InputFile,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: String? = null,
|
||||
@SerialName(captionField)
|
||||
override val text: String? = null,
|
||||
@SerialName(parseModeField)
|
||||
@ -182,8 +179,8 @@ data class SendAudioData internal constructor(
|
||||
|
||||
data class SendAudioFiles internal constructor(
|
||||
val audio: MultipartFile? = null,
|
||||
val thumb: MultipartFile? = null
|
||||
val thumbnail: MultipartFile? = null
|
||||
) : Files by mapOfNotNull(
|
||||
audioField to audio,
|
||||
thumbField to thumb
|
||||
thumbnailField to thumbnail
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -31,7 +32,7 @@ import kotlinx.serialization.*
|
||||
fun SendDocument(
|
||||
chatId: ChatIdentifier,
|
||||
document: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
@ -42,15 +43,13 @@ fun SendDocument(
|
||||
replyMarkup: KeyboardMarkup? = null,
|
||||
disableContentTypeDetection: Boolean? = null
|
||||
): Request<ContentMessage<DocumentContent>> {
|
||||
val documentAsFileId = (document as? FileId) ?.fileId
|
||||
val documentAsFile = document as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendDocumentData(
|
||||
chatId,
|
||||
documentAsFileId,
|
||||
thumbAsFileId,
|
||||
document,
|
||||
thumbnail ?.fileId,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
@ -66,9 +65,9 @@ fun SendDocument(
|
||||
return if (documentAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendDocumentFiles(documentAsFile, thumbAsFile)
|
||||
listOfNotNull(documentAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -85,7 +84,7 @@ fun SendDocument(
|
||||
fun SendDocument(
|
||||
chatId: ChatIdentifier,
|
||||
document: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
@ -95,15 +94,13 @@ fun SendDocument(
|
||||
replyMarkup: KeyboardMarkup? = null,
|
||||
disableContentTypeDetection: Boolean? = null
|
||||
): Request<ContentMessage<DocumentContent>> {
|
||||
val documentAsFileId = (document as? FileId) ?.fileId
|
||||
val documentAsFile = document as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendDocumentData(
|
||||
chatId,
|
||||
documentAsFileId,
|
||||
thumbAsFileId,
|
||||
document,
|
||||
thumbnail ?.fileId,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
@ -119,9 +116,9 @@ fun SendDocument(
|
||||
return if (documentAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendDocumentFiles(documentAsFile, thumbAsFile)
|
||||
listOfNotNull(documentAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -143,9 +140,9 @@ data class SendDocumentData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(documentField)
|
||||
val document: String? = null,
|
||||
@SerialName(thumbField)
|
||||
override val thumb: String? = null,
|
||||
val document: InputFile,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: String? = null,
|
||||
@SerialName(captionField)
|
||||
override val text: String? = null,
|
||||
@SerialName(parseModeField)
|
||||
@ -193,8 +190,8 @@ data class SendDocumentData internal constructor(
|
||||
|
||||
data class SendDocumentFiles internal constructor(
|
||||
val document: MultipartFile? = null,
|
||||
val thumb: MultipartFile? = null
|
||||
val thumbnail: MultipartFile? = null
|
||||
) : Files by mapOfNotNull(
|
||||
documentField to document,
|
||||
thumbField to thumb
|
||||
thumbnailField to thumbnail
|
||||
)
|
||||
|
@ -2,10 +2,12 @@ package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.media.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
|
||||
@ -37,7 +39,7 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null
|
||||
): Request<PossiblySentViaBotCommonMessage<MediaGroupContent<T>>> {
|
||||
): Request<ContentMessage<MediaGroupContent<T>>> {
|
||||
if (media.size !in mediaCountInMediaGroup) {
|
||||
throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size)
|
||||
}
|
||||
@ -66,11 +68,11 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
|
||||
return (if (files.isEmpty()) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendMediaGroupFiles(files)
|
||||
files.associateBy { it.fileId }
|
||||
)
|
||||
}) as Request<PossiblySentViaBotCommonMessage<MediaGroupContent<T>>>
|
||||
}) as Request<ContentMessage<MediaGroupContent<T>>>
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -33,7 +34,7 @@ fun SendPhoto(
|
||||
): Request<ContentMessage<PhotoContent>> {
|
||||
val data = SendPhotoData(
|
||||
chatId,
|
||||
(photo as? FileId) ?.fileId,
|
||||
photo,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
@ -45,12 +46,14 @@ fun SendPhoto(
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
return data.photo ?.let {
|
||||
return if (photo is MultipartFile) {
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
listOf(photo).associateBy { it.fileId }
|
||||
)
|
||||
} else {
|
||||
data
|
||||
} ?: MultipartRequestImpl(
|
||||
data,
|
||||
SendPhotoFiles(photo as MultipartFile)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun SendPhoto(
|
||||
@ -67,7 +70,7 @@ fun SendPhoto(
|
||||
): Request<ContentMessage<PhotoContent>> {
|
||||
val data = SendPhotoData(
|
||||
chatId,
|
||||
(photo as? FileId)?.fileId,
|
||||
photo,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
@ -79,12 +82,15 @@ fun SendPhoto(
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
return data.photo ?.let {
|
||||
|
||||
return if (photo is MultipartFile) {
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
listOf(photo).associateBy { it.fileId }
|
||||
)
|
||||
} else {
|
||||
data
|
||||
} ?: MultipartRequestImpl(
|
||||
data,
|
||||
SendPhotoFiles(photo as MultipartFile)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<PhotoContent>>
|
||||
@ -95,7 +101,7 @@ data class SendPhotoData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(photoField)
|
||||
val photo: String? = null,
|
||||
val photo: InputFile,
|
||||
@SerialName(captionField)
|
||||
override val text: String? = null,
|
||||
@SerialName(parseModeField)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -8,14 +9,19 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.StickerContent
|
||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||
import dev.inmo.tgbotapi.utils.toJsonWithoutNulls
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlinx.serialization.json.put
|
||||
|
||||
fun SendSticker(
|
||||
chatId: ChatIdentifier,
|
||||
sticker: InputFile,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
emoji: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -23,7 +29,7 @@ fun SendSticker(
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
|
||||
chatId,
|
||||
sticker as? FileId,
|
||||
sticker,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
@ -32,7 +38,10 @@ fun SendSticker(
|
||||
replyMarkup
|
||||
).let {
|
||||
when (sticker) {
|
||||
is MultipartFile -> SendStickerByFile(it, sticker)
|
||||
is MultipartFile -> CommonMultipartFileRequest(
|
||||
it,
|
||||
listOf(sticker).associateBy { it.fileId }
|
||||
)
|
||||
is FileId -> it
|
||||
}
|
||||
}
|
||||
@ -45,7 +54,7 @@ data class SendStickerByFileId internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(stickerField)
|
||||
val sticker: FileId? = null,
|
||||
val sticker: InputFile,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = chatId.threadId,
|
||||
@SerialName(disableNotificationField)
|
||||
@ -65,12 +74,3 @@ data class SendStickerByFileId internal constructor(
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
data class SendStickerByFile internal constructor(
|
||||
@Transient
|
||||
private val sendStickerByFileId: SendStickerByFileId,
|
||||
val sticker: MultipartFile
|
||||
) : MultipartRequest<ContentMessage<StickerContent>>, Request<ContentMessage<StickerContent>> by sendStickerByFileId {
|
||||
override val mediaMap: Map<String, MultipartFile> = mapOf(stickerField to sticker)
|
||||
override val paramsJson: JsonObject = sendStickerByFileId.toJsonWithoutNulls(SendStickerByFileId.serializer())
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -22,7 +23,7 @@ import kotlinx.serialization.*
|
||||
fun SendVideo(
|
||||
chatId: ChatIdentifier,
|
||||
video: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
spoilered: Boolean = false,
|
||||
@ -37,15 +38,13 @@ fun SendVideo(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<VideoContent>> {
|
||||
val videoAsFileId = (video as? FileId) ?.fileId
|
||||
val videoAsFile = video as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendVideoData(
|
||||
chatId,
|
||||
videoAsFileId,
|
||||
thumbAsFileId,
|
||||
video,
|
||||
thumbnail ?.fileId,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
@ -65,9 +64,9 @@ fun SendVideo(
|
||||
return if (videoAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendVideoFiles(videoAsFile, thumbAsFile)
|
||||
listOfNotNull(videoAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -75,7 +74,7 @@ fun SendVideo(
|
||||
fun SendVideo(
|
||||
chatId: ChatIdentifier,
|
||||
video: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
spoilered: Boolean = false,
|
||||
duration: Long? = null,
|
||||
@ -89,15 +88,13 @@ fun SendVideo(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<VideoContent>> {
|
||||
val videoAsFileId = (video as? FileId) ?.fileId
|
||||
val videoAsFile = video as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendVideoData(
|
||||
chatId,
|
||||
videoAsFileId,
|
||||
thumbAsFileId,
|
||||
video,
|
||||
thumbnail ?.fileId,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
@ -117,9 +114,9 @@ fun SendVideo(
|
||||
return if (videoAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendVideoFiles(videoAsFile, thumbAsFile)
|
||||
listOfNotNull(videoAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -132,9 +129,9 @@ data class SendVideoData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(videoField)
|
||||
val video: String? = null,
|
||||
@SerialName(thumbField)
|
||||
override val thumb: String? = null,
|
||||
val video: InputFile,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: String? = null,
|
||||
@SerialName(captionField)
|
||||
override val text: String? = null,
|
||||
@SerialName(parseModeField)
|
||||
@ -193,8 +190,8 @@ data class SendVideoData internal constructor(
|
||||
|
||||
data class SendVideoFiles internal constructor(
|
||||
val video: MultipartFile? = null,
|
||||
val thumb: MultipartFile? = null
|
||||
val thumbnail: MultipartFile? = null
|
||||
) : Files by mapOfNotNull(
|
||||
videoField to video,
|
||||
thumbField to thumb
|
||||
thumbnailField to thumbnail
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -14,7 +15,7 @@ import kotlinx.serialization.*
|
||||
fun SendVideoNote(
|
||||
chatId: ChatIdentifier,
|
||||
videoNote: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
thumbnail: InputFile? = null,
|
||||
duration: Long? = null,
|
||||
size: Int? = null, // in documentation - length (size of video side)
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
@ -24,15 +25,13 @@ fun SendVideoNote(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<VideoNoteContent>> {
|
||||
val videoNoteAsFileId = (videoNote as? FileId) ?.fileId
|
||||
val videoNoteAsFile = videoNote as? MultipartFile
|
||||
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||
val thumbAsFile = thumb as? MultipartFile
|
||||
val thumbAsFile = thumbnail as? MultipartFile
|
||||
|
||||
val data = SendVideoNoteData(
|
||||
chatId,
|
||||
videoNoteAsFileId,
|
||||
thumbAsFileId,
|
||||
videoNote,
|
||||
thumbnail ?.fileId,
|
||||
duration,
|
||||
size,
|
||||
threadId,
|
||||
@ -46,9 +45,9 @@ fun SendVideoNote(
|
||||
return if (videoNoteAsFile == null && thumbAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendVideoNoteFiles(videoNoteAsFile, thumbAsFile)
|
||||
listOfNotNull(videoNoteAsFile, thumbAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -61,9 +60,9 @@ data class SendVideoNoteData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(videoNoteField)
|
||||
val videoNote: String? = null,
|
||||
@SerialName(thumbField)
|
||||
override val thumb: String? = null,
|
||||
val videoNote: InputFile,
|
||||
@SerialName(thumbnailField)
|
||||
override val thumbnail: String? = null,
|
||||
@SerialName(durationField)
|
||||
override val duration: Long? = null,
|
||||
@SerialName(lengthField)
|
||||
@ -99,8 +98,8 @@ data class SendVideoNoteData internal constructor(
|
||||
|
||||
data class SendVideoNoteFiles internal constructor(
|
||||
val videoNote: MultipartFile? = null,
|
||||
val thumb: MultipartFile? = null
|
||||
val thumbnail: MultipartFile? = null
|
||||
) : Files by mapOfNotNull(
|
||||
videoNoteField to videoNote,
|
||||
thumbField to thumb
|
||||
thumbnailField to thumbnail
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -32,12 +33,11 @@ fun SendVoice(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<VoiceContent>> {
|
||||
val voiceAsFileId = (voice as? FileId) ?.fileId
|
||||
val voiceAsFile = voice as? MultipartFile
|
||||
|
||||
val data = SendVoiceData(
|
||||
chatId,
|
||||
voiceAsFileId,
|
||||
voice,
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
@ -53,9 +53,9 @@ fun SendVoice(
|
||||
return if (voiceAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendVoiceFiles(voiceAsFile)
|
||||
listOfNotNull(voiceAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -72,12 +72,11 @@ fun SendVoice(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<ContentMessage<VoiceContent>> {
|
||||
val voiceAsFileId = (voice as? FileId) ?.fileId
|
||||
val voiceAsFile = voice as? MultipartFile
|
||||
|
||||
val data = SendVoiceData(
|
||||
chatId,
|
||||
voiceAsFileId,
|
||||
voice,
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
@ -93,9 +92,9 @@ fun SendVoice(
|
||||
return if (voiceAsFile == null) {
|
||||
data
|
||||
} else {
|
||||
MultipartRequestImpl(
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
SendVoiceFiles(voiceAsFile)
|
||||
listOfNotNull(voiceAsFile).associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -108,7 +107,7 @@ data class SendVoiceData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(voiceField)
|
||||
val voice: String? = null,
|
||||
val voice: InputFile,
|
||||
@SerialName(captionField)
|
||||
override val text: String? = null,
|
||||
@SerialName(parseModeField)
|
||||
@ -156,8 +155,8 @@ data class SendVoiceData internal constructor(
|
||||
|
||||
data class SendVoiceFiles internal constructor(
|
||||
val voice: MultipartFile? = null,
|
||||
val thumb: MultipartFile? = null
|
||||
val thumbnail: MultipartFile? = null
|
||||
) : Files by mapOfNotNull(
|
||||
voiceField to voice,
|
||||
thumbField to thumb
|
||||
thumbnailField to thumbnail
|
||||
)
|
||||
|
@ -1,50 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun AddAnimatedStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
): Request<Boolean> {
|
||||
val data = AddAnimatedStickerToSet(userId, stickerSetName, emojis, sticker as? FileId, maskPosition)
|
||||
return when (sticker) {
|
||||
is MultipartFile -> CommonMultipartFileRequest(
|
||||
data,
|
||||
mapOf(tgsStickerField to sticker)
|
||||
)
|
||||
is FileId -> data
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class AddAnimatedStickerToSet internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(tgsStickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "addStickerToSet"
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun AddStaticStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
): Request<Boolean> {
|
||||
val data = AddStaticStickerToSet(userId, stickerSetName, emojis, sticker as? FileId, maskPosition)
|
||||
return when (sticker) {
|
||||
is MultipartFile -> CommonMultipartFileRequest(
|
||||
data,
|
||||
mapOf(pngStickerField to sticker)
|
||||
)
|
||||
is FileId -> data
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class AddStaticStickerToSet internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(pngStickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "addStickerToSet"
|
||||
}
|
@ -4,45 +4,32 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun AddVideoStickerToSet(
|
||||
fun AddStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition? = null
|
||||
inputSticker: InputSticker
|
||||
): Request<Boolean> {
|
||||
val data = AddVideoStickerToSet(userId, stickerSetName, emojis, sticker as? FileId, maskPosition)
|
||||
return when (sticker) {
|
||||
val data = AddStickerToSetData(userId, stickerSetName, inputSticker)
|
||||
return when (val sticker = inputSticker.sticker) {
|
||||
is MultipartFile -> CommonMultipartFileRequest(
|
||||
data,
|
||||
mapOf(webmStickerField to sticker)
|
||||
mapOf(sticker.fileId to sticker)
|
||||
)
|
||||
is FileId -> data
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class AddVideoStickerToSet internal constructor(
|
||||
data class AddStickerToSetData internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(webmStickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
@SerialName(stickerField)
|
||||
override val inputSticker: InputSticker
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
@ -1,40 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.CreateStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
@Deprecated("Use CreateNewStickerSet class instead")
|
||||
data class CreateNewAnimatedStickerSet internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(tgsStickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(containsMasksField)
|
||||
@Deprecated("Will be removed soon due to its redundancy")
|
||||
val containsMasks: Boolean? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : CreateStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "createNewStickerSet"
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.CreateStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
@Deprecated("Use CreateNewStickerSet class instead")
|
||||
data class CreateNewStaticStickerSet internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(pngStickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(containsMasksField)
|
||||
@Deprecated("Will be removed soon due to its redundancy")
|
||||
val containsMasks: Boolean? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : CreateStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "createNewStickerSet"
|
||||
}
|
@ -1,77 +1,186 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.micro_utils.serialization.mapper.MapperSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.CreateStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
internal fun CreateNewStickerSet(
|
||||
/**
|
||||
* Will create one of [CreateNewStickerSet] types based on the first element of [stickers]
|
||||
*
|
||||
* @param needsRepainting Will be used only if you are creating custom emojis sticker pack (by passing [stickers] with
|
||||
* type [InputSticker.WithKeywords.CustomEmoji])
|
||||
*/
|
||||
fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
emojis: String,
|
||||
stickerType: StickerType = StickerType.Regular,
|
||||
pngSticker: InputFile? = null,
|
||||
tgsSticker: InputFile? = null,
|
||||
webmSticker: InputFile? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean? = null
|
||||
): Request<Boolean> {
|
||||
val data = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
stickerType,
|
||||
pngSticker as? FileId,
|
||||
tgsSticker as? FileId,
|
||||
webmSticker as? FileId,
|
||||
maskPosition
|
||||
)
|
||||
return if (pngSticker is MultipartFile || tgsSticker is MultipartFile || webmSticker is MultipartFile) {
|
||||
CommonMultipartFileRequest(
|
||||
data,
|
||||
listOfNotNull(
|
||||
(pngSticker as? MultipartFile) ?.let { pngStickerField to it },
|
||||
(tgsSticker as? MultipartFile) ?.let { tgsStickerField to it },
|
||||
(webmSticker as? MultipartFile) ?.let { webmStickerField to it },
|
||||
).toMap()
|
||||
)
|
||||
val data = when(stickers.first()) {
|
||||
is InputSticker.Mask -> CreateNewStickerSet.Mask(userId, name, title, stickersFormat, stickers.filterIsInstance<InputSticker.Mask>())
|
||||
is InputSticker.WithKeywords.CustomEmoji -> CreateNewStickerSet.CustomEmoji(userId, name, title, stickersFormat, stickers.filterIsInstance<InputSticker.WithKeywords.CustomEmoji>(), needsRepainting)
|
||||
is InputSticker.WithKeywords.Regular -> CreateNewStickerSet.Regular(userId, name, title, stickersFormat, stickers.filterIsInstance<InputSticker.WithKeywords.Regular>())
|
||||
}
|
||||
val multipartParts = stickers.mapNotNull {
|
||||
(it.sticker as? MultipartFile)
|
||||
}
|
||||
return if (multipartParts.isNotEmpty()) {
|
||||
when (data) { // cratch for exact determining of common multipart data type
|
||||
is CreateNewStickerSet.CustomEmoji -> CommonMultipartFileRequest(
|
||||
data,
|
||||
multipartParts.associateBy { it.fileId }
|
||||
)
|
||||
is CreateNewStickerSet.Mask -> CommonMultipartFileRequest(
|
||||
data,
|
||||
multipartParts.associateBy { it.fileId }
|
||||
)
|
||||
is CreateNewStickerSet.Regular -> CommonMultipartFileRequest(
|
||||
data,
|
||||
multipartParts.associateBy { it.fileId }
|
||||
)
|
||||
}
|
||||
} else {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class CreateNewStickerSet internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(stickerTypeField)
|
||||
val stickerType: StickerType = StickerType.Regular,
|
||||
@SerialName(pngStickerField)
|
||||
val pngSticker: FileId? = null,
|
||||
@SerialName(tgsStickerField)
|
||||
val tgsSticker: FileId? = null,
|
||||
@SerialName(webmStickerField)
|
||||
val webmSticker: FileId? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : CreateStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
@Serializable(CreateNewStickerSetSerializer::class)
|
||||
sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
val stickerType: StickerType
|
||||
val stickers: List<InputSticker>
|
||||
val stickersFormat: StickerFormat
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "createNewStickerSet"
|
||||
|
||||
@Serializable
|
||||
data class Regular(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
override val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<InputSticker.WithKeywords.Regular>
|
||||
) : CreateNewStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
override val stickerType: StickerType
|
||||
get() = StickerType.Regular
|
||||
}
|
||||
@Serializable
|
||||
data class Mask(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
override val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<InputSticker.Mask>
|
||||
) : CreateNewStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
override val stickerType: StickerType
|
||||
get() = StickerType.Mask
|
||||
}
|
||||
@Serializable
|
||||
data class CustomEmoji(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
override val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
override val stickers: List<InputSticker.WithKeywords.CustomEmoji>,
|
||||
@SerialName(needsRepaintingField)
|
||||
val needsRepainting: Boolean? = null
|
||||
) : CreateNewStickerSet {
|
||||
@SerialName(stickerTypeField)
|
||||
override val stickerType: StickerType
|
||||
get() = StickerType.CustomEmoji
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class SurrogateCreateNewSticker internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
val stickersFormat: StickerFormat,
|
||||
@SerialName(stickersField)
|
||||
val stickers: List<InputSticker>,
|
||||
@SerialName(stickerTypeField)
|
||||
val stickerType: StickerType,
|
||||
@SerialName(needsRepaintingField)
|
||||
val needsRepainting: Boolean? = null
|
||||
) : CreateStickerSetAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = CreateNewStickerSet.serializer()
|
||||
|
||||
override fun method(): String = "createNewStickerSet"
|
||||
}
|
||||
}
|
||||
|
||||
object CreateNewStickerSetSerializer : KSerializer<CreateNewStickerSet>,
|
||||
MapperSerializer<CreateNewStickerSet.SurrogateCreateNewSticker, CreateNewStickerSet>(
|
||||
CreateNewStickerSet.SurrogateCreateNewSticker.serializer(),
|
||||
{
|
||||
CreateNewStickerSet.SurrogateCreateNewSticker(
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers,
|
||||
it.stickerType,
|
||||
(it as? CreateNewStickerSet.CustomEmoji)?.needsRepainting
|
||||
)
|
||||
},
|
||||
{
|
||||
when (it.stickerType) {
|
||||
StickerType.CustomEmoji -> CreateNewStickerSet.CustomEmoji(
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers.filterIsInstance<InputSticker.WithKeywords.CustomEmoji>(),
|
||||
it.needsRepainting
|
||||
)
|
||||
StickerType.Mask -> CreateNewStickerSet.Mask(
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers.filterIsInstance<InputSticker.Mask>(),
|
||||
)
|
||||
StickerType.Regular -> CreateNewStickerSet.Regular(
|
||||
it.userId,
|
||||
it.name,
|
||||
it.title,
|
||||
it.stickersFormat,
|
||||
it.stickers.filterIsInstance<InputSticker.WithKeywords.Regular>(),
|
||||
)
|
||||
is StickerType.Unknown -> error("Unable to create new sticker set due to error in type format: ${it.stickerType}")
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -1,40 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.CreateStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
@Deprecated("Use CreateNewStickerSet class instead")
|
||||
data class CreateNewVideoStickerSet internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(emojisField)
|
||||
override val emojis: String,
|
||||
@SerialName(webmStickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(containsMasksField)
|
||||
@Deprecated("Will be removed soon due to its redundancy")
|
||||
val containsMasks: Boolean? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : CreateStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "createNewStickerSet"
|
||||
}
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerAction
|
||||
import dev.inmo.tgbotapi.types.stickerField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
@ -9,8 +10,8 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
data class DeleteStickerFromSet(
|
||||
@SerialName(stickerField)
|
||||
val sticker: FileId
|
||||
) : SimpleRequest<Boolean> {
|
||||
override val sticker: FileId
|
||||
) : StickerAction<Boolean> {
|
||||
override fun method(): String = "deleteStickerFromSet"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
|
@ -0,0 +1,21 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.nameField
|
||||
import dev.inmo.tgbotapi.types.stickerField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class DeleteStickerSet(
|
||||
@SerialName(nameField)
|
||||
val name: StickerSetName
|
||||
) : SimpleRequest<Boolean> {
|
||||
override fun method(): String = "deleteStickerSet"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.micro_utils.serialization.mapper.MapperSerializer
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.emojiListField
|
||||
import dev.inmo.tgbotapi.types.keywordsField
|
||||
import dev.inmo.tgbotapi.types.maskPositionField
|
||||
import dev.inmo.tgbotapi.types.stickerField
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@ClassCastsIncluded
|
||||
@Serializable(InputStickerSerializer::class)
|
||||
sealed interface InputSticker {
|
||||
val sticker: InputFile
|
||||
val emojisList: List<String>
|
||||
|
||||
@Serializable
|
||||
data class Mask(
|
||||
@SerialName(stickerField)
|
||||
override val sticker: InputFile,
|
||||
@SerialName(emojiListField)
|
||||
override val emojisList: List<String>,
|
||||
@SerialName(maskPositionField)
|
||||
val maskPosition: MaskPosition? = null
|
||||
) : InputSticker
|
||||
|
||||
@Serializable
|
||||
sealed interface WithKeywords : InputSticker {
|
||||
val keywords: List<String>
|
||||
|
||||
@Serializable
|
||||
data class Regular(
|
||||
@SerialName(stickerField)
|
||||
override val sticker: InputFile,
|
||||
@SerialName(emojiListField)
|
||||
override val emojisList: List<String>,
|
||||
@SerialName(keywordsField)
|
||||
override val keywords: List<String>
|
||||
) : WithKeywords
|
||||
|
||||
@Serializable
|
||||
data class CustomEmoji(
|
||||
@SerialName(stickerField)
|
||||
override val sticker: InputFile,
|
||||
@SerialName(emojiListField)
|
||||
override val emojisList: List<String>,
|
||||
@SerialName(keywordsField)
|
||||
override val keywords: List<String>
|
||||
) : WithKeywords
|
||||
}
|
||||
}
|
||||
|
||||
object InputStickerSerializer : KSerializer<InputSticker>, MapperSerializer<InputStickerSerializer.SurrogateInputSticker, InputSticker>(
|
||||
SurrogateInputSticker.serializer(),
|
||||
{
|
||||
when (it) {
|
||||
is InputSticker.Mask -> SurrogateInputSticker(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
emptyList(),
|
||||
it.maskPosition,
|
||||
StickerType.Mask
|
||||
)
|
||||
is InputSticker.WithKeywords.CustomEmoji -> SurrogateInputSticker(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
it.keywords,
|
||||
null,
|
||||
StickerType.CustomEmoji
|
||||
)
|
||||
is InputSticker.WithKeywords.Regular -> SurrogateInputSticker(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
it.keywords,
|
||||
null,
|
||||
StickerType.Regular
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
when (it.internalType) {
|
||||
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
it.keywords
|
||||
)
|
||||
StickerType.Mask -> InputSticker.Mask(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
it.maskPosition
|
||||
)
|
||||
StickerType.Regular -> InputSticker.WithKeywords.Regular(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
it.keywords
|
||||
)
|
||||
is StickerType.Unknown -> InputSticker.WithKeywords.Regular(
|
||||
it.sticker,
|
||||
it.emojisList,
|
||||
it.keywords
|
||||
)
|
||||
}
|
||||
},
|
||||
) {
|
||||
@Serializable
|
||||
data class SurrogateInputSticker internal constructor(
|
||||
@SerialName(stickerField)
|
||||
val sticker: InputFile,
|
||||
@SerialName(emojiListField)
|
||||
val emojisList: List<String>,
|
||||
@SerialName(keywordsField)
|
||||
val keywords: List<String> = emptyList(),
|
||||
@SerialName(maskPositionField)
|
||||
val maskPosition: MaskPosition? = null,
|
||||
internal val internalType: StickerType = StickerType.Unknown()
|
||||
)
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
|
||||
fun CreateNewRegularStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
StickerType.Regular,
|
||||
pngSticker = sticker
|
||||
)
|
||||
|
||||
fun CreateNewRegularVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
StickerType.Regular,
|
||||
webmSticker = sticker
|
||||
)
|
||||
|
||||
fun CreateNewRegularAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
StickerType.Regular,
|
||||
tgsSticker = sticker
|
||||
)
|
||||
|
||||
|
||||
fun CreateNewMaskStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
StickerType.Mask,
|
||||
pngSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
||||
|
||||
fun CreateNewMaskVideoStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
StickerType.Mask,
|
||||
webmSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
||||
|
||||
fun CreateNewMaskAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
maskPosition: MaskPosition
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
StickerType.Mask,
|
||||
tgsSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
@ -1,80 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
|
||||
fun CreateNewVideoStickerSet(
|
||||
userId: UserId,
|
||||
linkName: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
linkName,
|
||||
title,
|
||||
emojis,
|
||||
if (containsMasks == true) StickerType.Mask else StickerType.Regular,
|
||||
webmSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
||||
|
||||
fun CreateNewStaticStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
if (containsMasks == true) StickerType.Mask else StickerType.Regular,
|
||||
pngSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
||||
|
||||
fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
if (containsMasks == true) StickerType.Mask else StickerType.Regular,
|
||||
pngSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
||||
|
||||
fun CreateNewAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
sticker: InputFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
): Request<Boolean> = CreateNewStickerSet(
|
||||
userId,
|
||||
name,
|
||||
title,
|
||||
emojis,
|
||||
if (containsMasks == true) StickerType.Mask else StickerType.Regular,
|
||||
tgsSticker = sticker,
|
||||
maskPosition = maskPosition
|
||||
)
|
@ -0,0 +1,21 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class SetCustomEmojiStickerSetThumbnail (
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(customEmojiIdField)
|
||||
val customEmojiId: CustomEmojiId
|
||||
) : StickerSetAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setCustomEmojiStickerSetThumbnail"
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class SetStickerEmojiList (
|
||||
@SerialName(stickerField)
|
||||
override val sticker: FileId,
|
||||
@SerialName(emojiListField)
|
||||
val emojis: List<String>
|
||||
) : StickerAction<Boolean> {
|
||||
constructor(sticker: FileId, vararg emojis: String) : this(sticker, emojis.toList())
|
||||
|
||||
init {
|
||||
require(emojis.size !in emojisInStickerLimit) {
|
||||
"Emojis size should be in range $emojisInStickerLimit, but was ${emojis.size}"
|
||||
}
|
||||
}
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setStickerEmojiList"
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class SetStickerKeywords (
|
||||
@SerialName(stickerField)
|
||||
override val sticker: FileId,
|
||||
@SerialName(keywordsField)
|
||||
val keywords: List<String>
|
||||
) : StickerAction<Boolean> {
|
||||
constructor(sticker: FileId, vararg keywords: String) : this(sticker, keywords.toList())
|
||||
|
||||
init {
|
||||
require(keywords.size !in keywordsInStickerLimit) {
|
||||
"Keywords list size should be in range $keywordsInStickerLimit, but was ${keywords.size}"
|
||||
}
|
||||
keywords.forEach {
|
||||
require(it.length in stickerKeywordLengthLimit) {
|
||||
"Keyword length should be in range $stickerKeywordLengthLimit, but was ${it.length} (word \"$it\")"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setStickerKeywords"
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class SetStickerMaskPosition (
|
||||
@SerialName(stickerField)
|
||||
override val sticker: FileId,
|
||||
@SerialName(maskPositionField)
|
||||
val maskPosition: MaskPosition
|
||||
) : StickerAction<Boolean> {
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setStickerMaskPosition"
|
||||
}
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerAction
|
||||
import dev.inmo.tgbotapi.types.positionField
|
||||
import dev.inmo.tgbotapi.types.stickerField
|
||||
import kotlinx.serialization.*
|
||||
@ -10,10 +11,10 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
data class SetStickerPositionInSet(
|
||||
@SerialName(stickerField)
|
||||
val sticker: FileId,
|
||||
override val sticker: FileId,
|
||||
@SerialName(positionField)
|
||||
val position: Int
|
||||
) : SimpleRequest<Boolean> {
|
||||
) : StickerAction<Boolean> {
|
||||
init {
|
||||
if (position < 0) {
|
||||
throw IllegalArgumentException("Position must be positive or 0")
|
||||
|
@ -2,32 +2,32 @@ package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun SetStickerSetThumb(
|
||||
fun SetStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
thumb: MultipartFile
|
||||
thumbnail: MultipartFile
|
||||
): Request<Boolean> {
|
||||
return CommonMultipartFileRequest(
|
||||
SetStickerSetThumb(userId, stickerSetName),
|
||||
mapOf(thumbField to thumb)
|
||||
SetStickerSetThumbnail(userId, stickerSetName),
|
||||
mapOf(thumbnailField to thumbnail)
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class SetStickerSetThumb (
|
||||
data class SetStickerSetThumbnail (
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(thumbField)
|
||||
val thumb: FileId? = null
|
||||
) : StickerSetAction {
|
||||
@SerialName(thumbnailField)
|
||||
val thumbnail: FileId? = null
|
||||
) : OwnerStickerSetAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setStickerSetThumb"
|
||||
override fun method(): String = "setStickerSetThumbnail"
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||
import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class SetStickerSetTitle (
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
val title: String
|
||||
) : StickerSetAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setStickerSetTitle"
|
||||
}
|
@ -13,7 +13,9 @@ data class UploadStickerFile(
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId,
|
||||
@Transient
|
||||
val sticker: MultipartFile = throw IllegalStateException("Detected autocreating try: this class can't be deserialized")
|
||||
val sticker: MultipartFile = throw IllegalStateException("Detected autocreating try: this class can't be deserialized"),
|
||||
@SerialName(stickerFormatField)
|
||||
val stickerFormat: StickerFormat
|
||||
): MultipartRequest<File> {
|
||||
init {
|
||||
// TODO:: add check of width/height of image and type of file - it must be png with max side length is 512px
|
||||
@ -21,7 +23,7 @@ data class UploadStickerFile(
|
||||
|
||||
override fun method(): String = "uploadStickerFile"
|
||||
@Transient
|
||||
override val mediaMap: Map<String, MultipartFile> = mapOf(pngStickerField to sticker)
|
||||
override val mediaMap: Map<String, MultipartFile> = mapOf(stickerField to sticker)
|
||||
@Transient
|
||||
override val paramsJson: JsonObject = toJsonWithoutNulls(serializer())
|
||||
override val resultDeserializer: DeserializationStrategy<File>
|
||||
|
@ -1,5 +1,5 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers.abstracts
|
||||
|
||||
interface CreateStickerSetAction : StandardStickerSetAction {
|
||||
interface CreateStickerSetAction : OwnerStickerSetAction {
|
||||
val title: String
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
interface OwnerStickerSetAction : StickerSetAction {
|
||||
val userId: UserId
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
interface StandardStickerSetAction : StickerSetAction {
|
||||
val emojis: String // must be more than one
|
||||
val maskPosition: MaskPosition?
|
||||
}
|
||||
interface StandardStickerSetAction : OwnerStickerSetAction {
|
||||
val inputSticker: InputSticker
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
|
||||
interface StickerAction<T : Any> : SimpleRequest<T> {
|
||||
val sticker: FileId
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
package dev.inmo.tgbotapi.requests.stickers.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
interface StickerSetAction : SimpleRequest<Boolean> {
|
||||
val userId: UserId
|
||||
val name: String
|
||||
val name: StickerSetName
|
||||
|
||||
override val resultDeserializer: KSerializer<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class BotDescription(
|
||||
@SerialName(descriptionField)
|
||||
val description: String
|
||||
)
|
@ -0,0 +1,10 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class BotShortDescription(
|
||||
@SerialName(shortDescriptionField)
|
||||
val shortDescription: String
|
||||
)
|
@ -83,6 +83,38 @@ sealed interface StickerType {
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable(StickerFormat.Serializer::class)
|
||||
sealed interface StickerFormat {
|
||||
val type: String
|
||||
|
||||
@Serializable
|
||||
object Static : StickerFormat { override val type: String = "static" }
|
||||
@Serializable
|
||||
object Animated : StickerFormat { override val type: String = "animated" }
|
||||
@Serializable
|
||||
object Video : StickerFormat { override val type: String = "video" }
|
||||
@Serializable
|
||||
data class Unknown(override val type: String = "custom_emoji") : StickerFormat
|
||||
|
||||
object Serializer : KSerializer<StickerFormat> {
|
||||
override val descriptor: SerialDescriptor = String.serializer().descriptor
|
||||
|
||||
override fun deserialize(decoder: Decoder): StickerFormat {
|
||||
return when (val type = decoder.decodeString()) {
|
||||
Static.type -> Static
|
||||
Animated.type -> Animated
|
||||
Video.type -> Video
|
||||
else -> Unknown(type)
|
||||
}
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: StickerFormat) {
|
||||
encoder.encodeString(value.type)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val usernameRegex = Regex("@[\\w\\d_]+")
|
||||
|
||||
val degreesLimit = 1 .. 360
|
||||
@ -134,6 +166,12 @@ val suggestedTipAmountsLimit = 1 .. 4
|
||||
|
||||
val inputFieldPlaceholderLimit = 1 .. 64
|
||||
|
||||
val emojisInStickerLimit = 1 .. 20
|
||||
|
||||
val keywordsInStickerLimit = 0 .. 20
|
||||
|
||||
val stickerKeywordLengthLimit = 0 .. 64
|
||||
|
||||
const val botActionActualityTime: Seconds = 5
|
||||
|
||||
// Made as lazy for correct work in K/JS
|
||||
@ -257,6 +295,7 @@ const val createsJoinRequestField = "creates_join_request"
|
||||
const val pendingJoinRequestCountField = "pending_join_request_count"
|
||||
const val memberLimitField = "member_limit"
|
||||
const val iconColorField = "icon_color"
|
||||
const val emojiListField = "emoji_list"
|
||||
|
||||
const val requestContactField = "request_contact"
|
||||
const val requestLocationField = "request_location"
|
||||
@ -325,9 +364,17 @@ const val stickerFileIdField = "sticker_file_id"
|
||||
|
||||
const val gameShortNameField = "game_short_name"
|
||||
|
||||
const val thumbnailUrlField = "thumbnail_url"
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailUrlField", "dev.inmo.tgbotapi.types.thumbnailUrlField"))
|
||||
const val thumbUrlField = "thumb_url"
|
||||
const val thumbnailMimeTypeField = "thumbnail_mime_type"
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailMimeTypeField", "dev.inmo.tgbotapi.types.thumbnailMimeTypeField"))
|
||||
const val thumbMimeTypeField = "thumb_mime_type"
|
||||
const val thumbnailWidthField = "thumbnail_width"
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailWidthField", "dev.inmo.tgbotapi.types.thumbnailWidthField"))
|
||||
const val thumbWidthField = "thumb_width"
|
||||
const val thumbnailHeightField = "thumbnail_height"
|
||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailHeightField", "dev.inmo.tgbotapi.types.thumbnailHeightField"))
|
||||
const val thumbHeightField = "thumb_height"
|
||||
|
||||
const val inputMessageContentField = "input_message_content"
|
||||
@ -373,6 +420,8 @@ const val webmStickerField = "webm_sticker"
|
||||
const val oldChatMemberField = "old_chat_member"
|
||||
const val newChatMemberField = "new_chat_member"
|
||||
const val stickerTypeField = "sticker_type"
|
||||
const val stickerFormatField = "sticker_format"
|
||||
const val needsRepaintingField = "needs_repainting"
|
||||
|
||||
const val okField = "ok"
|
||||
const val captionField = "caption"
|
||||
@ -380,11 +429,14 @@ const val explanationField = "explanation"
|
||||
const val idField = "id"
|
||||
const val pollIdField = "poll_id"
|
||||
const val textField = "text"
|
||||
const val thumbnailField = "thumbnail"
|
||||
@Deprecated("Renamed (in telegram bot api)", ReplaceWith("thumbnailField", "dev.inmo.tgbotapi.types.thumbnailField"))
|
||||
const val thumbField = "thumb"
|
||||
const val emojiField = "emoji"
|
||||
const val emojisField = "emojis"
|
||||
const val titleField = "title"
|
||||
const val descriptionField = "description"
|
||||
const val shortDescriptionField = "short_description"
|
||||
const val performerField = "performer"
|
||||
const val durationField = "duration"
|
||||
const val widthField = "width"
|
||||
@ -408,6 +460,7 @@ const val offsetField = "offset"
|
||||
const val limitField = "limit"
|
||||
const val stickersField = "stickers"
|
||||
const val stickerField = "sticker"
|
||||
const val keywordsField = "keywords"
|
||||
const val urlField = "url"
|
||||
const val addressField = "address"
|
||||
const val actionField = "action"
|
||||
|
@ -23,12 +23,12 @@ class InlineQueryResultArticle(
|
||||
val hideUrl: Boolean? = null,
|
||||
@SerialName(descriptionField)
|
||||
override val description: String? = null,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String? = null,
|
||||
@SerialName(thumbWidthField)
|
||||
override val thumbWidth: Int? = null,
|
||||
@SerialName(thumbHeightField)
|
||||
override val thumbHeight: Int? = null
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String? = null,
|
||||
@SerialName(thumbnailWidthField)
|
||||
override val thumbnailWidth: Int? = null,
|
||||
@SerialName(thumbnailHeightField)
|
||||
override val thumbnailHeight: Int? = null
|
||||
) : InlineQueryResult,
|
||||
ThumbSizedInlineQueryResult,
|
||||
TitledInlineQueryResult,
|
||||
|
@ -20,12 +20,12 @@ data class InlineQueryResultContact(
|
||||
override val lastName: String? = null,
|
||||
@SerialName(vcardField)
|
||||
override val vcard: String? = null,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String? = null,
|
||||
@SerialName(thumbWidthField)
|
||||
override val thumbWidth: Int? = null,
|
||||
@SerialName(thumbHeightField)
|
||||
override val thumbHeight: Int? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String? = null,
|
||||
@SerialName(thumbnailWidthField)
|
||||
override val thumbnailWidth: Int? = null,
|
||||
@SerialName(thumbnailHeightField)
|
||||
override val thumbnailHeight: Int? = null,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@SerialName(inputMessageContentField)
|
||||
|
@ -21,24 +21,24 @@ fun InlineQueryResultDocumentImpl(
|
||||
url: String,
|
||||
title: String,
|
||||
mimeType: MimeType,
|
||||
thumbUrl: String? = null,
|
||||
thumbWidth: Int? = null,
|
||||
thumbHeight: Int? = null,
|
||||
thumbnailUrl: String? = null,
|
||||
thumbnailWidth: Int? = null,
|
||||
thumbnailHeight: Int? = null,
|
||||
description: String? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbUrl, thumbWidth, thumbHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbnailUrl, thumbnailWidth, thumbnailHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultDocumentImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
title: String,
|
||||
mimeType: MimeType,
|
||||
thumbUrl: String? = null,
|
||||
thumbWidth: Int? = null,
|
||||
thumbHeight: Int? = null,
|
||||
thumbnailUrl: String? = null,
|
||||
thumbnailWidth: Int? = null,
|
||||
thumbnailHeight: Int? = null,
|
||||
description: String? = null,
|
||||
entities: TextSourcesList,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@ -48,9 +48,9 @@ fun InlineQueryResultDocumentImpl(
|
||||
url,
|
||||
title,
|
||||
mimeType,
|
||||
thumbUrl,
|
||||
thumbWidth,
|
||||
thumbHeight,
|
||||
thumbnailUrl,
|
||||
thumbnailWidth,
|
||||
thumbnailHeight,
|
||||
description,
|
||||
entities.makeString(),
|
||||
null,
|
||||
@ -69,12 +69,12 @@ data class InlineQueryResultDocumentImpl internal constructor(
|
||||
override val title: String,
|
||||
@SerialName(mimeTypeField)
|
||||
override val mimeType: MimeType,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String? = null,
|
||||
@SerialName(thumbWidthField)
|
||||
override val thumbWidth: Int? = null,
|
||||
@SerialName(thumbHeightField)
|
||||
override val thumbHeight: Int? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String? = null,
|
||||
@SerialName(thumbnailWidthField)
|
||||
override val thumbnailWidth: Int? = null,
|
||||
@SerialName(thumbnailHeightField)
|
||||
override val thumbnailHeight: Int? = null,
|
||||
@SerialName(descriptionField)
|
||||
override val description: String? = null,
|
||||
@SerialName(captionField)
|
||||
|
@ -20,8 +20,8 @@ import kotlinx.serialization.Serializable
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbMimeType: MimeType? = null,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
duration: Int? = null,
|
||||
@ -30,13 +30,13 @@ fun InlineQueryResultGifImpl(
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultGifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
) = InlineQueryResultGifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbMimeType: MimeType? = null,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
duration: Int? = null,
|
||||
@ -47,8 +47,8 @@ fun InlineQueryResultGifImpl(
|
||||
) = InlineQueryResultGifImpl(
|
||||
id,
|
||||
url,
|
||||
thumbUrl,
|
||||
thumbMimeType,
|
||||
thumbnailUrl,
|
||||
thumbnailMimeType,
|
||||
width,
|
||||
height,
|
||||
duration,
|
||||
@ -63,8 +63,8 @@ fun InlineQueryResultGifImpl(
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
gifFile: FileId,
|
||||
thumbUrl: String,
|
||||
thumbMimeType: MimeType? = null,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
duration: Int? = null,
|
||||
@ -73,13 +73,13 @@ fun InlineQueryResultGifImpl(
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
|
||||
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
gifFile: FileId,
|
||||
thumbUrl: String,
|
||||
thumbMimeType: MimeType? = null,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
duration: Int? = null,
|
||||
@ -88,7 +88,7 @@ fun InlineQueryResultGifImpl(
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultGifImpl(
|
||||
id, gifFile.fileId, thumbUrl, thumbMimeType, width, height, duration, title, entities, replyMarkup, inputMessageContent
|
||||
id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, entities, replyMarkup, inputMessageContent
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -97,10 +97,10 @@ data class InlineQueryResultGifImpl internal constructor(
|
||||
override val id: InlineQueryIdentifier,
|
||||
@SerialName(gifUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String,
|
||||
@SerialName(thumbMimeTypeField)
|
||||
override val thumbMimeType: MimeType? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String,
|
||||
@SerialName(thumbnailMimeTypeField)
|
||||
override val thumbnailMimeType: MimeType? = null,
|
||||
@SerialName(gifWidthField)
|
||||
override val width: Int? = null,
|
||||
@SerialName(gifHeightField)
|
||||
@ -126,8 +126,8 @@ data class InlineQueryResultGifImpl internal constructor(
|
||||
}
|
||||
|
||||
init {
|
||||
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
||||
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
|
||||
if (thumbnailMimeType != null && thumbnailMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
||||
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbnailMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ data class InlineQueryResultLocation(
|
||||
override val heading: Degrees? = null,
|
||||
@SerialName(proximityAlertRadiusField)
|
||||
override val proximityAlertRadius: Meters? = null,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String? = null,
|
||||
@SerialName(thumbWidthField)
|
||||
override val thumbWidth: Int? = null,
|
||||
@SerialName(thumbHeightField)
|
||||
override val thumbHeight: Int? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String? = null,
|
||||
@SerialName(thumbnailWidthField)
|
||||
override val thumbnailWidth: Int? = null,
|
||||
@SerialName(thumbnailHeightField)
|
||||
override val thumbnailHeight: Int? = null,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@SerialName(inputMessageContentField)
|
||||
|
@ -19,8 +19,8 @@ import kotlinx.serialization.Serializable
|
||||
fun InlineQueryResultMpeg4GifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbMimeType: MimeType? = null,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
duration: Int? = null,
|
||||
@ -29,13 +29,13 @@ fun InlineQueryResultMpeg4GifImpl(
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultMpeg4GifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
) = InlineQueryResultMpeg4GifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultMpeg4GifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbMimeType: MimeType? = null,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
duration: Int? = null,
|
||||
@ -46,8 +46,8 @@ fun InlineQueryResultMpeg4GifImpl(
|
||||
) = InlineQueryResultMpeg4GifImpl(
|
||||
id,
|
||||
url,
|
||||
thumbUrl,
|
||||
thumbMimeType,
|
||||
thumbnailUrl,
|
||||
thumbnailMimeType,
|
||||
width,
|
||||
height,
|
||||
duration,
|
||||
@ -65,10 +65,10 @@ data class InlineQueryResultMpeg4GifImpl internal constructor(
|
||||
override val id: InlineQueryIdentifier,
|
||||
@SerialName(mpeg4GifUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String,
|
||||
@SerialName(thumbMimeTypeField)
|
||||
override val thumbMimeType: MimeType? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String,
|
||||
@SerialName(thumbnailMimeTypeField)
|
||||
override val thumbnailMimeType: MimeType? = null,
|
||||
@SerialName(mpeg4GifWidthField)
|
||||
override val width: Int? = null,
|
||||
@SerialName(mpeg4GifHeightField)
|
||||
@ -94,8 +94,8 @@ data class InlineQueryResultMpeg4GifImpl internal constructor(
|
||||
}
|
||||
|
||||
init {
|
||||
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
||||
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
|
||||
if (thumbnailMimeType != null && thumbnailMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
||||
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbnailMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import kotlinx.serialization.Serializable
|
||||
fun InlineQueryResultPhotoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbnailUrl: String,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
title: String? = null,
|
||||
@ -27,12 +27,12 @@ fun InlineQueryResultPhotoImpl(
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultPhotoImpl(id, url, thumbUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
) = InlineQueryResultPhotoImpl(id, url, thumbnailUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultPhotoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbnailUrl: String,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
title: String? = null,
|
||||
@ -43,7 +43,7 @@ fun InlineQueryResultPhotoImpl(
|
||||
) = InlineQueryResultPhotoImpl(
|
||||
id,
|
||||
url,
|
||||
thumbUrl,
|
||||
thumbnailUrl,
|
||||
width,
|
||||
height,
|
||||
title,
|
||||
@ -61,8 +61,8 @@ data class InlineQueryResultPhotoImpl internal constructor(
|
||||
override val id: InlineQueryIdentifier,
|
||||
@SerialName(photoUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String,
|
||||
@SerialName(photoWidthField)
|
||||
override val width: Int? = null,
|
||||
@SerialName(photoHeightField)
|
||||
|
@ -29,12 +29,12 @@ data class InlineQueryResultVenue(
|
||||
override val googlePlaceId: GooglePlaceId? = null,
|
||||
@SerialName(googlePlaceTypeField)
|
||||
override val googlePlaceType: GooglePlaceType? = null,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String? = null,
|
||||
@SerialName(thumbWidthField)
|
||||
override val thumbWidth: Int? = null,
|
||||
@SerialName(thumbHeightField)
|
||||
override val thumbHeight: Int? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String? = null,
|
||||
@SerialName(thumbnailWidthField)
|
||||
override val thumbnailWidth: Int? = null,
|
||||
@SerialName(thumbnailHeightField)
|
||||
override val thumbnailHeight: Int? = null,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@SerialName(inputMessageContentField)
|
||||
|
@ -19,7 +19,7 @@ import kotlinx.serialization.Serializable
|
||||
fun InlineQueryResultVideoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbnailUrl: String,
|
||||
mimeType: MimeType,
|
||||
title: String,
|
||||
width: Int? = null,
|
||||
@ -30,12 +30,12 @@ fun InlineQueryResultVideoImpl(
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
inputMessageContent: InputMessageContent? = null
|
||||
) = InlineQueryResultVideoImpl(id, url, thumbUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
) = InlineQueryResultVideoImpl(id, url, thumbnailUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultVideoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
url: String,
|
||||
thumbUrl: String,
|
||||
thumbnailUrl: String,
|
||||
mimeType: MimeType,
|
||||
title: String,
|
||||
width: Int? = null,
|
||||
@ -48,7 +48,7 @@ fun InlineQueryResultVideoImpl(
|
||||
) = InlineQueryResultVideoImpl(
|
||||
id,
|
||||
url,
|
||||
thumbUrl,
|
||||
thumbnailUrl,
|
||||
mimeType,
|
||||
title,
|
||||
width,
|
||||
@ -68,8 +68,8 @@ data class InlineQueryResultVideoImpl internal constructor(
|
||||
override val id: InlineQueryIdentifier,
|
||||
@SerialName(videoUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbUrlField)
|
||||
override val thumbUrl: String,
|
||||
@SerialName(thumbnailUrlField)
|
||||
override val thumbnailUrl: String,
|
||||
@SerialName(mimeTypeField)
|
||||
override val mimeType: MimeType,
|
||||
@SerialName(titleField)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user