1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 00:03:48 +00:00

Merge pull request #839 from InsanusMokrassar/11.0.0

11.0.0
This commit is contained in:
InsanusMokrassar 2024-03-18 13:52:46 +06:00 committed by GitHub
commit fdc007f609
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
190 changed files with 3824 additions and 3330 deletions

View File

@ -1,5 +1,26 @@
# TelegramBotAPI changelog
## 11.0.0
**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS**
* `Core`:
* `MessageId` now is `value class`. `MessageIdentifier` become deprecated
* `MessageThreadId` now is `value class`
* `InlineQueryIdentifier` now is `value class`
* `MediaGroupIdentifier` has been renamed to `MediaGroupId` and now is `value class`
* `CallbackQueryIdentifier` has been renamed to `CallbackQueryId` and now is `value class`
* `WebAppQueryId` now is `value class`
* `PreCheckoutQueryId` now is `value class`
* `FileUniqueId` has been renamed to `TgFileUniqueId` and now is `value class`
* `UpdateIdentifier` has been renamed to `UpdateId` and now is `value class`
* `InlineMessageIdentifier` has been renamed to `InlineMessageId` and now is `value class`
* `ShippingQueryIdentifier` has been renamed to `ShippingQueryId` and now is `value class`
* `Identifier` has been renamed to `RawChatId` and now is `value class`
* `ShippingOptionIdentifier` has been renamed to `ShippingOptionId` and now is `value class`
* `PollIdentifier` has been renamed to `PollId` and now is `value class`
* `StickerSetName` now is `value class`
## 10.1.2
* `Version`:

View File

@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=10.1.2
library_version=11.0.0

File diff suppressed because it is too large Load Diff

View File

@ -27,15 +27,6 @@ suspend fun TelegramBot.deleteMessages(
messageIds = messageIds.toList()
)
suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId
) = deleteMessages(
chatId = chatId,
messageIds = (listOf(firstMessageId) + messageIds.toList())
)
suspend fun TelegramBot.deleteMessages(
messagesMetas: List<Message.MetaInfo>
) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
@ -60,14 +51,6 @@ suspend fun TelegramBot.delete(
messageIds: Array<MessageId>
) = deleteMessages(chatId = chatId, messageIds = messageIds)
suspend fun TelegramBot.delete(
chatId: ChatIdentifier,
firstMessageId: MessageId,
secondMessageId: MessageId,
vararg messageIds: MessageId
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
suspend fun TelegramBot.delete(
messagesMetas: List<Message.MetaInfo>
) = deleteMessages(messagesMetas)

View File

@ -48,25 +48,6 @@ suspend fun TelegramBot.forwardMessages(
removeCaption = removeCaption
)
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = (listOf(firstMessageId) + messageIds.toList()),
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
@ -139,26 +120,6 @@ suspend fun TelegramBot.forward(
removeCaption = removeCaption
)
suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
fromChatId = fromChatId,
firstMessageId = firstMessageId,
messageIds = *messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,

View File

@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.update.abstracts.Update
suspend fun TelegramBot.getUpdates(
offset: UpdateIdentifier? = null,
offset: UpdateId? = null,
limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST

View File

@ -1,13 +1,12 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.GetUpdates
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.update.abstracts.Update
suspend fun TelegramBot.getRawUpdates(
offset: UpdateIdentifier? = null,
offset: UpdateId? = null,
limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.InternalUtils
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
import dev.inmo.tgbotapi.types.MediaGroupId
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.update.*
@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
*/
internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
val resultUpdates = mutableListOf<Update>()
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
val mediaGroups = mutableMapOf<MediaGroupId, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
for (update in this) {
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {

View File

@ -3,10 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.answers
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
import dev.inmo.tgbotapi.types.CallbackQueryId
suspend fun TelegramBot.answerCallbackQuery(
callbackQueryId: CallbackQueryIdentifier,
callbackQueryId: CallbackQueryId,
text: String? = null,
showAlert: Boolean? = null,
url: String? = null,

View File

@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.InlineQueryId
suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryIdentifier,
inlineQueryID: InlineQueryId,
results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null,
isPersonal: Boolean? = null,
@ -37,7 +37,7 @@ suspend fun TelegramBot.answer(
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryIdentifier,
inlineQueryID: InlineQueryId,
results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null,
isPersonal: Boolean? = null,

View File

@ -3,12 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.answers.payments
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryError
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryOk
import dev.inmo.tgbotapi.types.ShippingQueryIdentifier
import dev.inmo.tgbotapi.types.ShippingQueryId
import dev.inmo.tgbotapi.types.payments.ShippingOption
import dev.inmo.tgbotapi.types.payments.ShippingQuery
suspend fun TelegramBot.answerShippingQueryOk(
id: ShippingQueryIdentifier,
id: ShippingQueryId,
shippingOptions: List<ShippingOption>
) = execute(AnswerShippingQueryOk(id, shippingOptions))
suspend fun TelegramBot.answerShippingQueryOk(
@ -17,7 +17,7 @@ suspend fun TelegramBot.answerShippingQueryOk(
) = answerShippingQueryOk(shippingQuery.id, shippingOptions)
suspend fun TelegramBot.answerShippingQueryError(
id: ShippingQueryIdentifier,
id: ShippingQueryId,
error: String
) = execute(AnswerShippingQueryError(id, error))
suspend fun TelegramBot.answerShippingQueryError(

View File

@ -1,21 +1,15 @@
package dev.inmo.tgbotapi.extensions.api.edit
import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.media.TelegramMedia
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
@ -26,7 +20,7 @@ import dev.inmo.tgbotapi.utils.buildEntities
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
latitude: Double,
longitude: Double,
horizontalAccuracy: Meters? = null,
@ -40,7 +34,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(
@ -52,7 +46,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
media: TelegramMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageMedia(messageId, media, replyMarkup)
@ -62,7 +56,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(messageId, replyMarkup)
@ -71,7 +65,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
@ -83,7 +77,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
@ -94,7 +88,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
@ -106,7 +100,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageIdentifier,
messageId: InlineMessageId,
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that
*/
suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
@ -23,7 +23,7 @@ suspend fun TelegramBot.editMessageCaption(
* as a builder for that
*/
suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup))

View File

@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation
suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
latitude: Double,
longitude: Double,
horizontalAccuracy: Meters? = null,
@ -20,7 +20,7 @@ suspend fun TelegramBot.editLiveLocation(
)
)
suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.location.live
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
/**
@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that
*/
suspend fun TelegramBot.stopLiveLocation(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
StopInlineMessageLiveLocation(

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.media.EditInlineMessageMedia
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import dev.inmo.tgbotapi.types.media.TelegramMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that
*/
suspend fun TelegramBot.editMessageMedia(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
media: TelegramMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
/**
@ -10,6 +10,6 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that
*/
suspend fun TelegramBot.editMessageReplyMarkup(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import dev.inmo.tgbotapi.types.LinkPreviewOptions
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
@ -16,7 +16,7 @@ import dev.inmo.tgbotapi.utils.buildEntities
* as a builder for that
*/
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
@ -28,7 +28,7 @@ suspend fun TelegramBot.editMessageText(
* as a builder for that
*/
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
@ -39,7 +39,7 @@ suspend fun TelegramBot.editMessageText(
* as a builder for that
*/
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
@ -51,7 +51,7 @@ suspend fun TelegramBot.editMessageText(
* as a builder for that
*/
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,

View File

@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
suspend fun TelegramBot.getGameScore(
userId: UserId,
inlineMessageId: InlineMessageIdentifier
inlineMessageId: InlineMessageId
) = execute(
GetGameHighScoresByInlineMessageId(
userId, inlineMessageId
@ -16,5 +16,5 @@ suspend fun TelegramBot.getGameScore(
suspend fun TelegramBot.getGameScore(
user: CommonUser,
inlineMessageId: InlineMessageIdentifier
inlineMessageId: InlineMessageId
) = getGameScore(user.id, inlineMessageId)

View File

@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
suspend fun TelegramBot.setGameScore(
userId: UserId,
score: Long,
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
force: Boolean = false,
disableEditMessage: Boolean = false
) = execute(
@ -20,7 +20,7 @@ suspend fun TelegramBot.setGameScore(
suspend fun TelegramBot.setGameScore(
user: CommonUser,
score: Long,
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
force: Boolean = false,
disableEditMessage: Boolean = false
) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage)

View File

@ -2,14 +2,21 @@ package dev.inmo.tgbotapi.extensions.api.get
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.get.GetStickerSet
import dev.inmo.tgbotapi.types.StickerSetName
import dev.inmo.tgbotapi.types.files.Sticker
suspend fun TelegramBot.getStickerSet(
name: String
name: StickerSetName
) = execute(
GetStickerSet(name)
)
suspend fun TelegramBot.getStickerSet(
name: String
) = getStickerSet(
StickerSetName(name)
)
suspend fun TelegramBot.getStickerSetOrNull(
sticker: Sticker
) = sticker.stickerSetName ?.let {

View File

@ -47,25 +47,6 @@ suspend fun TelegramBot.copyMessages(
removeCaption = removeCaption
)
suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = (listOf(firstMessageId) + messageIds.toList()),
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
@ -138,26 +119,6 @@ suspend fun TelegramBot.copy(
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
firstMessageId = firstMessageId,
messageIds = messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,

View File

@ -108,15 +108,15 @@ suspend inline fun TelegramBot.sendVoice(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVoice(
chatId,
voice,
entities,
duration,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
voice = voice,
entities = entities,
threadId = threadId,
duration = duration,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

View File

@ -4,6 +4,7 @@ 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.StickerSetName
import dev.inmo.tgbotapi.types.StickerType
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.UserId
@ -12,12 +13,18 @@ import dev.inmo.tgbotapi.types.stickers.StickerSet
suspend fun TelegramBot.addStickerToSet(
userId: UserId,
stickerSetName: String,
stickerSetName: StickerSetName,
inputSticker: InputSticker
) = execute(
AddStickerToSet(userId, stickerSetName, inputSticker)
)
suspend fun TelegramBot.addStickerToSet(
userId: UserId,
stickerSetName: String,
inputSticker: InputSticker
) = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker)
suspend fun TelegramBot.addStickerToSet(
userId: UserId,
stickerSet: StickerSet,

View File

@ -62,7 +62,7 @@ suspend fun TelegramBot.setStickerSetThumbnail(
stickerSet: StickerSet,
thumbnail: FileId
) = setStickerSetThumbnail(
user.id, stickerSet.name, thumbnail
user.id, stickerSet, thumbnail
)
suspend fun TelegramBot.setStickerSetThumbnail(
@ -70,5 +70,5 @@ suspend fun TelegramBot.setStickerSetThumbnail(
stickerSet: StickerSet,
thumbnail: MultipartFile
) = setStickerSetThumbnail(
user.id, stickerSet.name, thumbnail
user.id, stickerSet, thumbnail
)

View File

@ -326,22 +326,22 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEditedContentKt {
public static final fun waitEditedAnimation (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAnimation$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAnyMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAnyMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudio (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudio$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudioMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudioMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAnyMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAnyMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudio (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudio$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudioMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudioMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedContact (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedContact$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDice (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDice$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocument (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocument$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocumentMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocumentMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocument (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocument$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocumentMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocumentMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedGame (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedGame$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedGiveawayContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@ -354,28 +354,28 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitEditedLiveLocation$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedLocation (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedLocation$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMedia (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMedia$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMessageContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMessageContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedPhoto (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedPhoto$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMedia (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMedia$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMessageContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMessageContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedPhoto (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedPhoto$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedStaticLocation (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedStaticLocation$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedSticker (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedSticker$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedText (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedText$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedTextedMediaContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedTextedMediaContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedTextedMediaContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedTextedMediaContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVenue (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVenue$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVideo (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVideo$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVideo (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVideo$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVideoNote (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVideoNote$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVisualMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVisualMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVisualMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVisualMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVoice (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVoice$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
@ -387,16 +387,16 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitEditedAnyMediaGroupContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudioMediaGroupContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudioMediaGroupContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudioMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudioMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedAudioMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedAudioMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedContactMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedContactMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDiceMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDiceMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocumentMediaGroupContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocumentMediaGroupContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocumentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocumentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedDocumentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedDocumentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedGameMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedGameMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedGiveawayContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@ -409,12 +409,12 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitEditedLiveLocationMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedLocationMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedLocationMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMediaMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMediaMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMediaMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMediaMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedMessageContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedMessageContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedPhotoMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedPhotoMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedPhotoMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedPhotoMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedStaticLocationMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedStaticLocationMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedStickerMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@ -425,8 +425,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitEditedTextedMediaContentMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVenueMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVenueMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVideoMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVideoMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVideoMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVideoMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVideoNoteMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitEditedVideoNoteMessage$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitEditedVisualMediaGroupContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@ -1303,8 +1303,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_f
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdCallbackQueryMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdCallbackQueryMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/queries/callback/CallbackQuery;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun invoke-gcdXFtE (Ldev/inmo/tgbotapi/types/queries/callback/CallbackQuery;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdChatBoostRemovedMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
@ -1321,20 +1321,20 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_f
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdInlineQueryMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdInlineQueryMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/InlineQueries/query/InlineQuery;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun invoke-nHD9vJQ (Ldev/inmo/tgbotapi/types/InlineQueries/query/InlineQuery;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollAnswerMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollAnswerMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/polls/PollAnswer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun invoke-ErVIubg (Ldev/inmo/tgbotapi/types/polls/PollAnswer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/polls/Poll;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun invoke-ErVIubg (Ldev/inmo/tgbotapi/types/polls/Poll;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByUserCallbackQueryMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {

View File

@ -5,7 +5,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder
import dev.inmo.micro_utils.coroutines.*
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder
import dev.inmo.tgbotapi.types.UpdateIdentifier
import dev.inmo.tgbotapi.types.UpdateId
import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.updateshandlers.*
import kotlinx.coroutines.*
@ -72,7 +72,7 @@ class DefaultBehaviourContext(
private val additionalUpdatesSharedFlow = MutableSharedFlow<Update>(0, broadcastChannelsSize, onBufferOverflow)
override val allUpdatesFlow: Flow<Update> = (additionalUpdatesSharedFlow.asSharedFlow()).let {
if (upstreamUpdatesFlow != null) {
val handledUpdates = mutableSetOf<UpdateIdentifier>()
val handledUpdates = mutableSetOf<UpdateId>()
(it + upstreamUpdatesFlow).filter {
val passed = handledUpdates.add(it.updateId)
(passed).also { passed ->

View File

@ -13,131 +13,118 @@ import kotlinx.coroutines.flow.map
@RiskFeature(lowLevelRiskFeatureMessage)
suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedContent(
initRequest: Request<*>? = null,
includeMediaGroups: Boolean = true,
noinline errorFactory: NullableRequestBuilder<*> = { null }
): Flow<O> = waitEditedContentMessage<O>(initRequest, errorFactory).map { it.content }
suspend fun BehaviourContext.waitEditedMessageContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<MessageContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<MessageContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedContentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<MessageContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<MessageContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedContact(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<ContactContent>(initRequest, false, errorFactory)
) = waitEditedContent<ContactContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedDice(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<DiceContent>(initRequest, false, errorFactory)
) = waitEditedContent<DiceContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedGame(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<GameContent>(initRequest, false, errorFactory)
) = waitEditedContent<GameContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedLocation(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<LocationContent>(initRequest, false, errorFactory)
) = waitEditedContent<LocationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedLiveLocation(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<LiveLocationContent>(initRequest, false, errorFactory)
) = waitEditedContent<LiveLocationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedStaticLocation(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<StaticLocationContent>(initRequest, false, errorFactory)
) = waitEditedContent<StaticLocationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedText(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<TextContent>(initRequest, false, errorFactory)
) = waitEditedContent<TextContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVenue(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<VenueContent>(initRequest, false, errorFactory)
) = waitEditedContent<VenueContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAudioMediaGroupContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<AudioMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<AudioMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedDocumentMediaGroupContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<DocumentMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<DocumentMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedMedia(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContent<MediaContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<MediaContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAnyMediaGroupContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<MediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<MediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVisualMediaGroupContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<VisualMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedTextedMediaContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true
) = waitEditedContent<TextedMediaContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<TextedMediaContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAnimation(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<AnimationContent>(initRequest, false, errorFactory)
) = waitEditedContent<AnimationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAudio(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContent<AudioContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<AudioContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedDocument(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContent<DocumentContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<DocumentContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedPhoto(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContent<PhotoContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<PhotoContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedSticker(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<StickerContent>(initRequest, false, errorFactory)
) = waitEditedContent<StickerContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVideo(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContent<VideoContent>(initRequest, includeMediaGroups, errorFactory)
) = waitEditedContent<VideoContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVideoNote(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<VideoNoteContent>(initRequest, false, errorFactory)
) = waitEditedContent<VideoNoteContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVoice(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<VoiceContent>(initRequest, false, errorFactory)
) = waitEditedContent<VoiceContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedInvoice(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
) = waitEditedContent<InvoiceContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedGiveawayContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<GiveawayContent>(initRequest, false, errorFactory)
) = waitEditedContent<GiveawayContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, false, errorFactory)
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, errorFactory)

View File

@ -81,7 +81,6 @@ suspend fun BehaviourContext.waitEditedDocumentMediaGroupContentMessage(
suspend fun BehaviourContext.waitEditedMediaMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContentMessage<MediaContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAnyMediaGroupContentMessage(
initRequest: Request<*>? = null,
@ -102,17 +101,14 @@ suspend fun BehaviourContext.waitEditedAnimationMessage(
suspend fun BehaviourContext.waitEditedAudioMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContentMessage<AudioContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedDocumentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContentMessage<DocumentContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedPhotoMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContentMessage<PhotoContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedStickerMessage(
initRequest: Request<*>? = null,
@ -121,7 +117,6 @@ suspend fun BehaviourContext.waitEditedStickerMessage(
suspend fun BehaviourContext.waitEditedVideoMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false
) = waitEditedContentMessage<VideoContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVideoNoteMessage(
initRequest: Request<*>? = null,

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,3 @@ import dev.inmo.tgbotapi.types.chat.PreviewChat
interface WithPreviewChat {
val chat: PreviewChat
}
/**
* All inheritors of this interface have [chat] field and related to this [chat]
*/
@Deprecated("Renamed", ReplaceWith("WithPreviewChat", "dev.inmo.tgbotapi.abstracts.WithPreviewChat"))
typealias WithChat = WithPreviewChat

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
interface InlineMessageAction {
val inlineMessageId: InlineMessageIdentifier
val inlineMessageId: InlineMessageId
}

View File

@ -7,6 +7,3 @@ interface LinkPreviewOptionsContainer {
val disableWebPagePreview: Boolean?
get() = linkPreviewOptions ?.isDisabled != true
}
@Deprecated("Renamed", ReplaceWith("LinkPreviewOptionsContainer", "dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer"))
typealias DisableWebPagePreview = LinkPreviewOptionsContainer

View File

@ -3,17 +3,11 @@ package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.ReplyParameters
@Deprecated("Renamed", ReplaceWith("WithReplyParameters", "dev.inmo.tgbotapi.abstracts.types.WithReplyParameters"))
interface ReplyMessageId {
val replyToMessageId: MessageId?
val allowSendingWithoutReply: Boolean?
}
interface WithReplyParameters : ReplyMessageId {
interface WithReplyParameters {
val replyParameters: ReplyParameters?
override val replyToMessageId: MessageId?
val replyToMessageId: MessageId?
get() = replyParameters ?.messageId
override val allowSendingWithoutReply: Boolean?
val allowSendingWithoutReply: Boolean?
get() = replyParameters ?.allowSendingWithoutReply
}

View File

@ -27,25 +27,6 @@ fun ForwardMessages(
removeCaption = removeCaption
)
fun ForwardMessages(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = ForwardMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = (listOf(messageId) + messageIds.toList()),
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
@Serializable
data class ForwardMessages (
@SerialName(chatIdField)

View File

@ -21,7 +21,7 @@ private val updatesListSerializer = ListSerializer(
*/
@Serializable
data class GetUpdates(
override val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
override val offset: UpdateId? = null,// set `last update id + 1` to receive next part of updates
override val limit: Int = getUpdatesLimit.last,
override val timeout: Seconds? = null,
override val allowed_updates: List<String>? = ALL_UPDATES_LIST

View File

@ -1,9 +1,8 @@
package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.UpdateIdentifier
import dev.inmo.tgbotapi.types.UpdateId
import dev.inmo.tgbotapi.types.getUpdatesLimit
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.Serializable
@ -16,7 +15,7 @@ import kotlinx.serialization.json.JsonArray
*/
@Serializable
data class GetUpdatesRaw(
override val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
override val offset: UpdateId? = null,// set `last update id + 1` to receive next part of updates
override val limit: Int = getUpdatesLimit.last,
override val timeout: Seconds? = null,
override val allowed_updates: List<String>? = ALL_UPDATES_LIST

View File

@ -1,14 +1,11 @@
package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.UpdateIdentifier
import dev.inmo.tgbotapi.types.getUpdatesLimit
import dev.inmo.tgbotapi.types.UpdateId
interface GetUpdatesRequest<T : Any> : SimpleRequest<T> {
val offset: UpdateIdentifier?
val offset: UpdateId?
val limit: Int
val timeout: Seconds?
val allowed_updates: List<String>?

View File

@ -9,7 +9,7 @@ import kotlinx.serialization.builtins.serializer
@Serializable
data class AnswerCallbackQuery(
@SerialName(callbackQueryIdField)
val callbackQueryId: CallbackQueryIdentifier,
val callbackQueryId: CallbackQueryId,
@SerialName(textField)
val text: String? = null,
@SerialName(showAlertField)

View File

@ -13,7 +13,7 @@ import kotlinx.serialization.builtins.serializer
@Serializable
data class AnswerInlineQuery(
@SerialName(inlineQueryIdField)
val inlineQueryID: InlineQueryIdentifier,
val inlineQueryID: InlineQueryId,
@Serializable(InlineQueryAnswersResultsSerializer::class)
@SerialName(resultsField)
val results: List<InlineQueryResult> = emptyList(),
@ -27,7 +27,7 @@ data class AnswerInlineQuery(
val button: InlineQueryResultsButton? = null,
) : SimpleRequest<Boolean> {
constructor(
inlineQueryID: InlineQueryIdentifier,
inlineQueryID: InlineQueryId,
results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null,
isPersonal: Boolean? = null,

View File

@ -11,7 +11,7 @@ import kotlinx.serialization.builtins.ListSerializer
@Serializable
data class AnswerShippingQueryOk(
@SerialName(shippingQueryIdField)
override val shippingQueryId: ShippingQueryIdentifier,
override val shippingQueryId: ShippingQueryId,
@Serializable(ShippingOptionsSerializer::class)
@SerialName(shippingOptionsField)
val shippingOptions: List<ShippingOption>
@ -30,7 +30,7 @@ object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ListSeri
@Serializable
data class AnswerShippingQueryError(
@SerialName(shippingQueryIdField)
override val shippingQueryId: ShippingQueryIdentifier,
override val shippingQueryId: ShippingQueryId,
@SerialName(errorMessageField)
val error: String
) : AnswerShippingQuery {

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.requests.answers.payments.abstracts
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ShippingQueryIdentifier
import dev.inmo.tgbotapi.types.ShippingQueryId
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.builtins.serializer
@ -10,6 +10,6 @@ interface AnswerShippingQuery : SimpleRequest<Boolean> {
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
val shippingQueryId: ShippingQueryIdentifier
val shippingQueryId: ShippingQueryId
val isOk: Boolean
}

View File

@ -1,12 +1,12 @@
package dev.inmo.tgbotapi.requests.edit.abstracts
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.builtins.serializer
interface EditInlineMessage : SimpleRequest<Boolean> {
val inlineMessageId: InlineMessageIdentifier
val inlineMessageId: InlineMessageId
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
}

View File

@ -3,6 +3,3 @@ package dev.inmo.tgbotapi.requests.edit.abstracts
import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer
interface EditLinkPreviewOptionsContainer : LinkPreviewOptionsContainer
@Deprecated("Renamed", ReplaceWith("EditLinkPreviewOptionsContainer", "dev.inmo.tgbotapi.requests.edit.abstracts.EditLinkPreviewOptionsContainer"))
typealias EditDisableWebPagePreviewMessage = EditLinkPreviewOptionsContainer

View File

@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.utils.extensions.makeString
import kotlinx.serialization.*
fun EditInlineMessageCaption(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
@ -26,7 +26,7 @@ fun EditInlineMessageCaption(
)
fun EditInlineMessageCaption(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null
) = EditInlineMessageCaption(
@ -40,7 +40,7 @@ fun EditInlineMessageCaption(
@Serializable
data class EditInlineMessageCaption internal constructor(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(captionField)
override val text: String,
@SerialName(parseModeField)

View File

@ -9,7 +9,7 @@ import kotlinx.serialization.*
@Serializable
data class EditInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)

View File

@ -9,7 +9,7 @@ import kotlinx.serialization.*
@Serializable
data class StopInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {

View File

@ -10,7 +10,7 @@ import kotlinx.serialization.*
@Serializable
data class EditInlineMessageMedia(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(mediaField)
override val media: TelegramMedia,
@SerialName(replyMarkupField)

View File

@ -9,7 +9,7 @@ import kotlinx.serialization.*
@Serializable
data class EditInlineMessageReplyMarkup(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {

View File

@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.utils.extensions.makeString
import kotlinx.serialization.*
fun EditInlineMessageText(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
@ -28,7 +28,7 @@ fun EditInlineMessageText(
)
fun EditInlineMessageText(
inlineMessageId: InlineMessageIdentifier,
inlineMessageId: InlineMessageId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
@ -44,7 +44,7 @@ fun EditInlineMessageText(
@Serializable
data class EditInlineMessageText internal constructor(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(textField)
override val text: String,
@SerialName(parseModeField)

View File

@ -10,7 +10,7 @@ data class GetGameHighScoresByInlineMessageId (
@SerialName(userIdField)
override val userId: UserId,
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier
override val inlineMessageId: InlineMessageId
) : GetGameHighScores, InlineMessageAction {
override val requestSerializer: SerializationStrategy<*>
get() = serializer()

View File

@ -12,7 +12,7 @@ data class SetGameScoreByInlineMessageId (
@SerialName(scoreField)
override val score: Long,
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
override val inlineMessageId: InlineMessageId,
@SerialName(forceField)
override val force: Boolean = false,
@SerialName(disableEditMessageField)

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.requests.get
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.StickerSetName
import dev.inmo.tgbotapi.types.nameField
import dev.inmo.tgbotapi.types.stickerSetNameField
import dev.inmo.tgbotapi.types.stickers.StickerSet
@ -9,7 +10,7 @@ import kotlinx.serialization.*
@Serializable
data class GetStickerSet(
@SerialName(nameField)
val name: String
val name: StickerSetName
): SimpleRequest<StickerSet> {
override fun method(): String = "getStickerSet"
override val resultDeserializer: DeserializationStrategy<StickerSet>

View File

@ -33,25 +33,6 @@ fun CopyMessages(
removeCaption = removeCaption
)
fun CopyMessages(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = CopyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = (listOf(messageId) + messageIds.toList()),
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
@Serializable
data class CopyMessages (
@SerialName(chatIdField)

View File

@ -8,7 +8,7 @@ import kotlinx.serialization.*
fun AddStickerToSet(
userId: UserId,
stickerSetName: String,
stickerSetName: StickerSetName,
inputSticker: InputSticker
): Request<Boolean> {
val data = AddStickerToSetData(userId, stickerSetName, inputSticker)
@ -21,12 +21,22 @@ fun AddStickerToSet(
}
}
fun AddStickerToSet(
userId: UserId,
stickerSetName: String,
inputSticker: InputSticker
): Request<Boolean> = AddStickerToSet(
userId = userId,
stickerSetName = StickerSetName(stickerSetName),
inputSticker = inputSticker
)
@Serializable
data class AddStickerToSetData internal constructor(
@SerialName(userIdField)
override val userId: UserId,
@SerialName(nameField)
override val name: String,
override val name: StickerSetName,
@SerialName(stickerField)
override val inputSticker: InputSticker
) : StandardStickerSetAction {

View File

@ -19,7 +19,7 @@ import kotlinx.serialization.encoding.Encoder
*/
fun CreateNewStickerSet(
userId: UserId,
name: String,
name: StickerSetName,
title: String,
stickersFormat: StickerFormat,
stickers: List<InputSticker>,
@ -53,6 +53,28 @@ 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,
stickersFormat: StickerFormat,
stickers: List<InputSticker>,
needsRepainting: Boolean? = null
) = CreateNewStickerSet(
userId = userId,
name = StickerSetName(name),
title = title,
stickersFormat = stickersFormat,
stickers = stickers,
needsRepainting = needsRepainting
)
@Serializable(CreateNewStickerSetSerializer::class)
sealed interface CreateNewStickerSet : CreateStickerSetAction {
val stickerType: StickerType
@ -69,7 +91,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
@SerialName(userIdField)
override val userId: UserId,
@SerialName(nameField)
override val name: String,
override val name: StickerSetName,
@SerialName(titleField)
override val title: String,
@SerialName(stickerFormatField)
@ -86,7 +108,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
@SerialName(userIdField)
override val userId: UserId,
@SerialName(nameField)
override val name: String,
override val name: StickerSetName,
@SerialName(titleField)
override val title: String,
@SerialName(stickerFormatField)
@ -103,7 +125,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
@SerialName(userIdField)
override val userId: UserId,
@SerialName(nameField)
override val name: String,
override val name: StickerSetName,
@SerialName(titleField)
override val title: String,
@SerialName(stickerFormatField)
@ -123,7 +145,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
@SerialName(userIdField)
override val userId: UserId,
@SerialName(nameField)
override val name: String,
override val name: StickerSetName,
@SerialName(titleField)
override val title: String,
@SerialName(stickerFormatField)

View File

@ -8,7 +8,7 @@ import kotlinx.serialization.*
fun SetStickerSetThumbnail(
userId: UserId,
stickerSetName: String,
stickerSetName: StickerSetName,
thumbnail: MultipartFile
): Request<Boolean> {
return CommonMultipartFileRequest(
@ -17,6 +17,16 @@ fun SetStickerSetThumbnail(
)
}
fun SetStickerSetThumbnail(
userId: UserId,
stickerSetName: String,
thumbnail: MultipartFile
): Request<Boolean> = SetStickerSetThumbnail(
userId = userId,
stickerSetName = StickerSetName(stickerSetName),
thumbnail = thumbnail
)
@Serializable
data class SetStickerSetThumbnail (
@SerialName(userIdField)

View File

@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class CallbackQueryId(
val string: String
) {
override fun toString(): String {
return string
}
}
@Deprecated("Renamed", ReplaceWith("CallbackQueryId", "dev.inmo.tgbotapi.types.CallbackQueryId"))
typealias CallbackQueryIdentifier = CallbackQueryId

View File

@ -26,13 +26,13 @@ sealed interface ChatIdentifier
*/
@Serializable(ChatIdentifierSerializer::class)
sealed interface IdChatIdentifier : ChatIdentifier {
abstract val chatId: Identifier
abstract val chatId: RawChatId
val threadId: MessageThreadId?
get() = null
companion object {
operator fun invoke(chatId: Identifier) = ChatId(chatId)
operator fun invoke(chatId: Identifier, threadId: MessageThreadId?) = threadId ?.let {
operator fun invoke(chatId: RawChatId) = ChatId(chatId)
operator fun invoke(chatId: RawChatId, threadId: MessageThreadId?) = threadId ?.let {
ChatIdWithThreadId(chatId, threadId)
} ?: ChatId(chatId)
}
@ -40,17 +40,17 @@ sealed interface IdChatIdentifier : ChatIdentifier {
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
value class ChatId(override val chatId: Identifier) : IdChatIdentifier
value class ChatId(override val chatId: RawChatId) : IdChatIdentifier
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<Identifier, MessageThreadId>) : IdChatIdentifier {
override val chatId: Identifier
value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<RawChatId, MessageThreadId>) : IdChatIdentifier {
override val chatId: RawChatId
get() = chatIdWithThreadId.first
override val threadId: MessageThreadId
get() = chatIdWithThreadId.second
constructor(chatId: Identifier, threadId: MessageThreadId): this(chatId to threadId)
constructor(chatId: RawChatId, threadId: MessageThreadId): this(chatId to threadId)
}
val ChatIdentifier.threadId: MessageThreadId?
@ -67,7 +67,7 @@ fun IdChatIdentifier.toChatWithThreadId(threadId: MessageThreadId) = IdChatIdent
* https://core.telegram.org/bots/api#formatting-options
*/
@Warning("This API have restrictions in Telegram System")
val Identifier.userLink: String
val RawChatId.userLink: String
get() = "$internalUserLinkBeginning$this"
/**
* https://core.telegram.org/bots/api#formatting-options
@ -80,23 +80,20 @@ val User.userLink: String
typealias UserId = ChatId
fun Identifier.toChatId(): ChatId = ChatId(this)
fun Int.toChatId(): IdChatIdentifier = toLong().toChatId()
fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
fun RawChatId.toChatId(): ChatId = ChatId(this)
fun Long.toChatId(): ChatId = ChatId(RawChatId(this))
fun Int.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId()
fun Byte.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId()
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
value class Username(
@Deprecated("Renamed", ReplaceWith("full"))
val username: String
) : ChatIdentifier {
val full: String
get() = username
) : ChatIdentifier {
val username: String
get() = full
val withoutAt
get() = full.dropWhile { it == '@' }
@Deprecated("Renamed", ReplaceWith("withoutAt"))
val usernameWithoutAt
get() = withoutAt
init {
if (!full.startsWith("@")) {
@ -119,7 +116,7 @@ object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
val id = internalSerializer.deserialize(decoder)
return id.longOrNull ?.let {
ChatId(it)
ChatId(RawChatId(it))
} ?: id.content.let {
if (!it.startsWith("@")) {
Username("@$it")
@ -131,7 +128,7 @@ object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
override fun serialize(encoder: Encoder, value: ChatIdentifier) {
when (value) {
is IdChatIdentifier -> encoder.encodeLong(value.chatId)
is IdChatIdentifier -> encoder.encodeLong(value.chatId.long)
is Username -> encoder.encodeString(value.full)
}
}
@ -145,14 +142,14 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
val id = internalSerializer.deserialize(decoder)
return id.longOrNull ?.let {
ChatId(it)
ChatId(RawChatId(it))
} ?:let {
val splitted = id.content.split("/")
if (splitted.size == 2) {
val (chatId, threadId) = splitted
ChatIdWithThreadId(
chatId.toLongOrNull() ?: return@let null,
threadId.toLongOrNull() ?: return@let null
chatId.toLongOrNull() ?.let(::RawChatId) ?: return@let null,
threadId.toLongOrNull() ?.let(::MessageThreadId) ?: return@let null
)
} else {
null
@ -168,7 +165,7 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
override fun serialize(encoder: Encoder, value: ChatIdentifier) {
when (value) {
is ChatId -> encoder.encodeLong(value.chatId)
is ChatId -> encoder.encodeLong(value.chatId.long)
is ChatIdWithThreadId -> encoder.encodeString("${value.chatId}/${value.threadId}")
is Username -> encoder.encodeString(value.full)
}

View File

@ -10,7 +10,7 @@ data class ChatPhoto(
@SerialName(bigFileIdField)
val bigFileId: String,
@SerialName(smallFileUniqueIdField)
val smallFileUniqueId: FileUniqueId,
val smallFileUniqueId: TgFileUniqueId,
@SerialName(bigFileUniqueIdField)
val bigFileUniqueId: FileUniqueId
val bigFileUniqueId: TgFileUniqueId
)

View File

@ -1,55 +1,19 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.utils.BuiltinMimeTypes
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlin.jvm.JvmInline
typealias Identifier = Long
typealias MessageId = Long
typealias MessageThreadId = Long
typealias MessageIdentifier = MessageId
typealias InlineQueryIdentifier = String
typealias UpdateIdentifier = Long
typealias MediaGroupIdentifier = String
typealias ForwardSignature = String
typealias ForwardSenderName = String
typealias AuthorSignature = ForwardSignature
typealias CallbackQueryIdentifier = String
typealias PaymentQueryIdentifier = String
typealias PreCheckoutQueryId = String
typealias ShippingQueryIdentifier = String
typealias InvoicePayload = String
typealias ShippingOptionIdentifier = String
typealias StartParameter = String
typealias InlineMessageIdentifier = String
typealias PollIdentifier = String
typealias StickerSetName = String
typealias FileUniqueId = String
typealias DiceResult = Int
typealias FoursquareId = String
typealias FoursquareType = String
typealias GooglePlaceId = String
typealias GooglePlaceType = String
typealias MembersLimit = Int
typealias WebAppQueryId = String
@Serializable
@JvmInline
value class CustomEmojiId(
val string: String
) {
val appLink
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
}
@Serializable
@JvmInline
value class StoryId(
val long: Long
)
typealias Seconds = Int
typealias MilliSeconds = Long
@ -59,70 +23,6 @@ typealias UnixTimeStamp = LongSeconds
typealias Meters = Float
typealias Degrees = Int
@Serializable(StickerType.Serializer::class)
sealed interface StickerType {
val type: String
@Serializable
object Regular : StickerType { override val type: String = "regular" }
@Serializable
object Mask : StickerType { override val type: String = "mask" }
@Serializable
object CustomEmoji : StickerType { override val type: String = "custom_emoji" }
@Serializable
data class Unknown(override val type: String = "custom_emoji") : StickerType
object Serializer : KSerializer<StickerType> {
override val descriptor: SerialDescriptor = String.serializer().descriptor
override fun deserialize(decoder: Decoder): StickerType {
return when (val type = decoder.decodeString()) {
Regular.type -> Regular
Mask.type -> Mask
CustomEmoji.type -> CustomEmoji
else -> Unknown(type)
}
}
override fun serialize(encoder: Encoder, value: StickerType) {
encoder.encodeString(value.type)
}
}
}
@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

View File

@ -0,0 +1,13 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class CustomEmojiId(
val string: String
) {
val appLink
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
}

View File

@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class InlineMessageId(
val string: String
) {
override fun toString(): String {
return string
}
}
@Deprecated("Renamed", ReplaceWith("InlineMessageId", "dev.inmo.tgbotapi.types.InlineMessageId"))
typealias InlineMessageIdentifier = InlineMessageId

View File

@ -7,9 +7,9 @@ import kotlinx.serialization.Serializable
@Serializable
data class BaseChosenInlineResult(
override val resultId: InlineQueryIdentifier,
override val resultId: InlineQueryId,
@SerialName(fromField)
override val from: User,
override val inlineMessageId: InlineMessageIdentifier?,
override val inlineMessageId: InlineMessageId?,
override val query: String
) : ChosenInlineResult

View File

@ -1,11 +1,11 @@
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
import dev.inmo.tgbotapi.abstracts.FromUser
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.InlineMessageId
import dev.inmo.tgbotapi.types.InlineQueryId
sealed interface ChosenInlineResult : FromUser {
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
val inlineMessageId: InlineMessageIdentifier?
val resultId: InlineQueryId //chosen temporary, can be changed
val inlineMessageId: InlineMessageId?
val query: String
}

View File

@ -8,10 +8,10 @@ import kotlinx.serialization.Serializable
@Serializable
data class LocationChosenInlineResult(
override val resultId: InlineQueryIdentifier,
override val resultId: InlineQueryId,
@SerialName(fromField)
override val from: User,
val location: StaticLocation,
override val inlineMessageId: InlineMessageIdentifier?,
override val inlineMessageId: InlineMessageId?,
override val query: String
) : ChosenInlineResult

View File

@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable
@Serializable
internal data class RawChosenInlineResult(
@SerialName(resultIdField)
val resultId: InlineQueryIdentifier, //chosen temporary, can be changed
val resultId: InlineQueryId, //chosen temporary, can be changed
@SerialName(fromField)
val user: User,
@SerialName(queryField)
@ -17,7 +17,7 @@ internal data class RawChosenInlineResult(
@SerialName(locationField)
val location: StaticLocation? = null,
@SerialName(inlineMessageIdField)
val inlineMessageId: InlineMessageIdentifier? = null
val inlineMessageId: InlineMessageId? = null
) {
val asChosenInlineResult: ChosenInlineResult by lazy {
location ?.let {

View File

@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable
@Serializable
class InlineQueryResultArticle(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(titleField)
override val title: String,
@SerialName(inputMessageContentField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultAudioCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
text: String? = null,
parseMode: ParseMode? = null,
@ -26,7 +26,7 @@ fun InlineQueryResultAudioCachedImpl(
) = InlineQueryResultAudioCachedImpl(id, fileId, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultAudioCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null,
@ -44,7 +44,7 @@ fun InlineQueryResultAudioCachedImpl(
@Serializable
data class InlineQueryResultAudioCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(audioFileIdField)
override val fileId: FileId,
@SerialName(captionField)

View File

@ -16,7 +16,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultAudioImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
title: String,
performer: String? = null,
@ -28,7 +28,7 @@ fun InlineQueryResultAudioImpl(
) = InlineQueryResultAudioImpl(id, url, title, performer, duration, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultAudioImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
title: String,
performer: String? = null,
@ -52,7 +52,7 @@ fun InlineQueryResultAudioImpl(
@Serializable
data class InlineQueryResultAudioImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(audioUrlField)
override val url: String,
@SerialName(titleField)

View File

@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultContact(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(phoneNumberField)
override val phoneNumber: String,
@SerialName(firstNameField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultDocumentCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String,
description: String? = null,
@ -28,7 +28,7 @@ fun InlineQueryResultDocumentCachedImpl(
) = InlineQueryResultDocumentCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultDocumentCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String,
description: String? = null,
@ -50,7 +50,7 @@ fun InlineQueryResultDocumentCachedImpl(
@Serializable
data class InlineQueryResultDocumentCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(documentFileIdField)
override val fileId: FileId,
@SerialName(titleField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultDocumentImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
title: String,
mimeType: MimeType,
@ -32,7 +32,7 @@ fun InlineQueryResultDocumentImpl(
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbnailUrl, thumbnailWidth, thumbnailHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultDocumentImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
title: String,
mimeType: MimeType,
@ -62,7 +62,7 @@ fun InlineQueryResultDocumentImpl(
@Serializable
data class InlineQueryResultDocumentImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(documentUrlField)
override val url: String,
@SerialName(titleField)

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.InlineQueryId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.gameShortNameField
import kotlinx.serialization.SerialName
@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable
@Serializable
class InlineQueryResultGame(
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(gameShortNameField)
val gameShortName: String,
override val replyMarkup: InlineKeyboardMarkup? = null

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultGifCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String? = null,
text: String? = null,
@ -27,7 +27,7 @@ fun InlineQueryResultGifCachedImpl(
) = InlineQueryResultGifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultGifCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String? = null,
entities: TextSourcesList,
@ -47,7 +47,7 @@ fun InlineQueryResultGifCachedImpl(
@Serializable
data class InlineQueryResultGifCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(gifFileIdField)
override val fileId: FileId,
@SerialName(titleField)

View File

@ -18,7 +18,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
@ -33,7 +33,7 @@ fun InlineQueryResultGifImpl(
) = InlineQueryResultGifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
@ -61,7 +61,7 @@ fun InlineQueryResultGifImpl(
)
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
gifFile: FileId,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
@ -76,7 +76,7 @@ fun InlineQueryResultGifImpl(
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
gifFile: FileId,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
@ -94,7 +94,7 @@ fun InlineQueryResultGifImpl(
@Serializable
data class InlineQueryResultGifImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(gifUrlField)
override val url: String,
@SerialName(thumbnailUrlField)

View File

@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultLocation(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultMpeg4GifCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String? = null,
text: String? = null,
@ -27,7 +27,7 @@ fun InlineQueryResultMpeg4GifCachedImpl(
) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultMpeg4GifCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String? = null,
entities: TextSourcesList,
@ -47,7 +47,7 @@ fun InlineQueryResultMpeg4GifCachedImpl(
@Serializable
data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(mpeg4GifFileIdField)
override val fileId: FileId,
@SerialName(titleField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultMpeg4GifImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
@ -32,7 +32,7 @@ fun InlineQueryResultMpeg4GifImpl(
) = InlineQueryResultMpeg4GifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultMpeg4GifImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
@ -62,7 +62,7 @@ fun InlineQueryResultMpeg4GifImpl(
@Serializable
data class InlineQueryResultMpeg4GifImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(mpeg4GifUrlField)
override val url: String,
@SerialName(thumbnailUrlField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultPhotoCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String? = null,
description: String? = null,
@ -28,7 +28,7 @@ fun InlineQueryResultPhotoCachedImpl(
) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultPhotoCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String? = null,
description: String? = null,
@ -50,7 +50,7 @@ fun InlineQueryResultPhotoCachedImpl(
@Serializable
data class InlineQueryResultPhotoCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(photoFileIdField)
override val fileId: FileId,
@SerialName(titleField)

View File

@ -16,7 +16,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultPhotoImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
width: Int? = null,
@ -30,7 +30,7 @@ fun InlineQueryResultPhotoImpl(
) = InlineQueryResultPhotoImpl(id, url, thumbnailUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultPhotoImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
width: Int? = null,
@ -58,7 +58,7 @@ fun InlineQueryResultPhotoImpl(
@Serializable
data class InlineQueryResultPhotoImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(photoUrlField)
override val url: String,
@SerialName(thumbnailUrlField)

View File

@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultStickerCached(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(stickerFileIdField)
override val fileId: FileId,
@SerialName(replyMarkupField)

View File

@ -12,7 +12,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVenue(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultVideoCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String,
description: String? = null,
@ -28,7 +28,7 @@ fun InlineQueryResultVideoCachedImpl(
) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultVideoCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String,
description: String? = null,
@ -50,7 +50,7 @@ fun InlineQueryResultVideoCachedImpl(
@Serializable
data class InlineQueryResultVideoCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(videoFileIdField)
override val fileId: FileId,
@SerialName(titleField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultVideoImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
mimeType: MimeType,
@ -33,7 +33,7 @@ fun InlineQueryResultVideoImpl(
) = InlineQueryResultVideoImpl(id, url, thumbnailUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultVideoImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
thumbnailUrl: String,
mimeType: MimeType,
@ -65,7 +65,7 @@ fun InlineQueryResultVideoImpl(
@Serializable
data class InlineQueryResultVideoImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(videoUrlField)
override val url: String,
@SerialName(thumbnailUrlField)

View File

@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultVoiceCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String,
text: String? = null,
@ -27,7 +27,7 @@ fun InlineQueryResultVoiceCachedImpl(
) = InlineQueryResultVoiceCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultVoiceCachedImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
fileId: FileId,
title: String,
entities: TextSourcesList,
@ -47,7 +47,7 @@ fun InlineQueryResultVoiceCachedImpl(
@Serializable
data class InlineQueryResultVoiceCachedImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(voiceFileIdField)
override val fileId: FileId,
@SerialName(titleField)

View File

@ -16,7 +16,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun InlineQueryResultVoiceImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
title: String,
duration: Int? = null,
@ -37,7 +37,7 @@ fun InlineQueryResultVoiceImpl(
)
fun InlineQueryResultVoiceImpl(
id: InlineQueryIdentifier,
id: InlineQueryId,
url: String,
title: String,
duration: Int? = null,
@ -59,7 +59,7 @@ fun InlineQueryResultVoiceImpl(
@Serializable
data class InlineQueryResultVoiceImpl internal constructor(
@SerialName(idField)
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
@SerialName(voiceUrlField)
override val url: String,
@SerialName(titleField)

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.InlineQueryId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.Serializable
@ -10,6 +10,6 @@ import kotlinx.serialization.Serializable
@ClassCastsIncluded(excludeRegex = ".*Impl")
interface InlineQueryResult {
val type: String
val id: InlineQueryIdentifier
val id: InlineQueryId
val replyMarkup: InlineKeyboardMarkup?
}

View File

@ -1,12 +1,11 @@
package dev.inmo.tgbotapi.types.InlineQueries.query
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.InlineQueryId
import dev.inmo.tgbotapi.types.chat.ChatType
import dev.inmo.tgbotapi.types.chat.CommonUser
data class BaseInlineQuery(
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
override val from: CommonUser,
override val query: String,
override val offset: String,

View File

@ -1,13 +1,12 @@
package dev.inmo.tgbotapi.types.InlineQueries.query
import dev.inmo.tgbotapi.abstracts.FromUser
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.InlineQueryId
import dev.inmo.tgbotapi.types.chat.ChatType
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.chat.User
sealed interface InlineQuery : FromUser {
val id: InlineQueryIdentifier
val id: InlineQueryId
val query: String
val offset: String
val chatType: ChatType?

View File

@ -1,13 +1,12 @@
package dev.inmo.tgbotapi.types.InlineQueries.query
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.InlineQueryId
import dev.inmo.tgbotapi.types.chat.ChatType
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.location.Location
data class LocationInlineQuery(
override val id: InlineQueryIdentifier,
override val id: InlineQueryId,
override val from: CommonUser,
override val query: String,
override val offset: String,

View File

@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types.InlineQueries.query
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.*
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.location.Location
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@ -10,7 +9,7 @@ import kotlinx.serialization.Serializable
@Serializable
internal data class RawInlineQuery(
@SerialName(idField)
val id: InlineQueryIdentifier,
val id: InlineQueryId,
@SerialName(fromField)
val from: CommonUser,
@SerialName(queryField)

View File

@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class InlineQueryId(
val string: String
) {
override fun toString(): String {
return string
}
}
@Deprecated("Renamed", ReplaceWith("InlineQueryId", "dev.inmo.tgbotapi.types.InlineQueryId"))
typealias InlineQueryIdentifier = InlineQueryId

View File

@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class MediaGroupId(
val string: String
) {
override fun toString(): String {
return string
}
}
@Deprecated("Renamed", ReplaceWith("MediaGroupId", "dev.inmo.tgbotapi.types.MediaGroupId"))
typealias MediaGroupIdentifier = MediaGroupId

View File

@ -1,24 +1,41 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
import kotlin.jvm.JvmInline
object MessageIdSerializer : KSerializer<MessageId> {
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
override fun deserialize(decoder: Decoder): MessageId = JsonObject.serializer().deserialize(decoder)[messageIdField]!!.jsonPrimitive.long
override fun deserialize(decoder: Decoder): MessageId = JsonObject.serializer().deserialize(decoder)[messageIdField]!!.jsonPrimitive.long.asTelegramMessageId()
override fun serialize(encoder: Encoder, value: MessageId) {
JsonObject.serializer().serialize(
encoder,
JsonObject(
mapOf(
messageIdField to JsonPrimitive(value)
messageIdField to JsonPrimitive(value.long)
)
)
)
}
}
@Serializable
@JvmInline
value class MessageId(
val long: Long
) {
override fun toString(): String {
return long.toString()
}
}
fun Long.asTelegramMessageId() = MessageId(this)
@Deprecated("Renamed", ReplaceWith("MessageId", "dev.inmo.tgbotapi.types.MessageId"))
typealias MessageIdentifier = MessageId

View File

@ -0,0 +1,14 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class MessageThreadId(
val long: Long
) {
override fun toString(): String {
return long.toString()
}
}

View File

@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class PollId(
val string: String
) {
override fun toString(): String {
return string
}
}
@Deprecated("Renamed", ReplaceWith("PollId", "dev.inmo.tgbotapi.types.PollId"))
typealias PollIdentifier = String

View File

@ -0,0 +1,14 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class PreCheckoutQueryId(
val string: String
) {
override fun toString(): String {
return string
}
}

View File

@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class RawChatId(
val long: Long
) {
companion object {
val DefaultUserId = RawChatId(136817688L) // I do not know why, it is Telegram crutch
}
override fun toString(): String {
return long.toString()
}
}
@Deprecated("Renamed", ReplaceWith("RawChatId", "dev.inmo.tgbotapi.types.RawChatId"))
typealias Identifier = RawChatId

View File

@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class ShippingOptionId(
val string: String
) {
override fun toString(): String {
return string
}
}
@Deprecated("ShippingOptionId", ReplaceWith("ShippingOptionId", "dev.inmo.tgbotapi.types.ShippingOptionId"))
typealias ShippingOptionIdentifier = ShippingOptionId

Some files were not shown because too many files have changed in this diff Show More