1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-15 05:09:30 +00:00

add sendPaidMedia, refactor telegram media, fix build

This commit is contained in:
2024-07-09 01:56:53 +06:00
parent 9dd80be36d
commit 5baa09f0c1
27 changed files with 1231 additions and 510 deletions

View File

@@ -740,6 +740,46 @@ suspend fun TelegramBot.send(
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo, text, parseMode, showCaptionAboveMedia, spoilered, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
/**
* Will execute [sendPaidMedia] request
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.send(
chat: Chat,
starCount: Int,
media: List<TelegramPaidMedia>,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPaidMedia(chat, starCount, media, text, parseMode, showCaptionAboveMedia, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* Will execute [sendPaidMedia] request
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.send(
chatId: ChatIdentifier,
starCount: Int,
media: List<TelegramPaidMedia>,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPaidMedia(chatId, starCount, media, text, parseMode, showCaptionAboveMedia, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* Will execute [sendPhoto] request
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or

View File

@@ -0,0 +1,140 @@
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.media.SendPaidMedia
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.media.TelegramPaidMedia
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendPaidMedia(
chatId: ChatIdentifier,
starCount: Int,
media: List<TelegramPaidMedia>,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPaidMedia(
chatId = chatId,
starCount = starCount,
media = media,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendPaidMedia(
chat: Chat,
starCount: Int,
media: List<TelegramPaidMedia>,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPaidMedia(
chatId = chat.id,
starCount = starCount,
media = media,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.sendPaidMedia(
chatId: ChatIdentifier,
starCount: Int,
media: List<TelegramPaidMedia>,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPaidMedia(
chatId = chatId,
starCount = starCount,
media = media,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.sendPaidMedia(
chat: Chat,
starCount: Int,
media: List<TelegramPaidMedia>,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPaidMedia(
chatId = chat.id,
starCount = starCount,
media = media,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)