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

improve support of media adding to text messages

This commit is contained in:
InsanusMokrassar 2024-11-01 14:44:20 +06:00
parent 50b2db8859
commit 65048648b8
2 changed files with 25 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption 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.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.media.addMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia 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.reply_markup.editMessageReplyMarkup
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
@ -173,6 +174,17 @@ public suspend fun TelegramBot.edit(
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message, media, businessConnectionId, replyMarkup) ): ContentMessage<MediaContent> = editMessageMedia(message, media, businessConnectionId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.addMedia(
message: ContentMessage<TextContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = addMessageMedia(message, media, businessConnectionId, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that * as a builder for that

View File

@ -11,6 +11,8 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MediaContent import dev.inmo.tgbotapi.types.message.content.MediaContent
import dev.inmo.tgbotapi.types.message.content.TextContent
import kotlin.jvm.JvmName
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@ -48,3 +50,14 @@ public suspend fun TelegramBot.editMessageMedia(
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message.chat.id, message.messageId, media, businessConnectionId, replyMarkup) ): ContentMessage<MediaContent> = editMessageMedia(message.chat.id, message.messageId, media, businessConnectionId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.addMessageMedia(
message: ContentMessage<TextContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message.chat.id, message.messageId, media, businessConnectionId, replyMarkup)