mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
Merge pull request #873 from bpavuk/bpavuk.reply-extension-paid-media
Implemented paid media reply extension
This commit is contained in:
commit
ebac413997
@ -2234,3 +2234,69 @@ suspend fun TelegramBot.reply(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
to: AccessibleMessage,
|
||||||
|
starCount: Int,
|
||||||
|
media: List<TelegramPaidMedia>,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
showCaptionAboveMedia: Boolean = false,
|
||||||
|
threadId: MessageThreadId? = to.chat.id.threadId,
|
||||||
|
businessConnectionId: BusinessConnectionId? = to.chat.id.businessConnectionId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) {
|
||||||
|
sendPaidMedia(
|
||||||
|
chatId = to.chat.id,
|
||||||
|
starCount = starCount,
|
||||||
|
media = media,
|
||||||
|
entities = entities,
|
||||||
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
|
threadId = threadId,
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyMarkup = replyMarkup,
|
||||||
|
replyParameters = ReplyParameters(
|
||||||
|
messageId = to.messageId,
|
||||||
|
chatIdentifier = to.chat.id,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
to: AccessibleMessage,
|
||||||
|
starCount: Int,
|
||||||
|
media: List<TelegramPaidMedia>,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
showCaptionAboveMedia: Boolean = false,
|
||||||
|
threadId: MessageThreadId? = to.chat.id.threadId,
|
||||||
|
businessConnectionId: BusinessConnectionId? = to.chat.id.businessConnectionId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) {
|
||||||
|
sendPaidMedia(
|
||||||
|
chatId = to.chat.id,
|
||||||
|
starCount = starCount,
|
||||||
|
media = media,
|
||||||
|
text = text,
|
||||||
|
parseMode = parseMode,
|
||||||
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
|
threadId = threadId,
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyMarkup = replyMarkup,
|
||||||
|
replyParameters = ReplyParameters(
|
||||||
|
messageId = to.messageId,
|
||||||
|
chatIdentifier = to.chat.id,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
@ -26,6 +26,9 @@ import dev.inmo.tgbotapi.types.games.Game
|
|||||||
import dev.inmo.tgbotapi.types.location.*
|
import dev.inmo.tgbotapi.types.location.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
|
import dev.inmo.tgbotapi.types.message.payments.PaidMedia
|
||||||
|
import dev.inmo.tgbotapi.types.message.payments.toTelegramMediaPhoto
|
||||||
|
import dev.inmo.tgbotapi.types.message.payments.toTelegramPaidMediaVideo
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
||||||
import dev.inmo.tgbotapi.types.polls.*
|
import dev.inmo.tgbotapi.types.polls.*
|
||||||
@ -2045,3 +2048,71 @@ suspend fun TelegramBot.reply(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
toChatId: IdChatIdentifier,
|
||||||
|
toMessageId: MessageId,
|
||||||
|
starCount: Int,
|
||||||
|
media: List<TelegramPaidMedia>,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
showCaptionAboveMedia: Boolean = false,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) {
|
||||||
|
sendPaidMedia(
|
||||||
|
chatId = toChatId,
|
||||||
|
starCount = starCount,
|
||||||
|
media = media,
|
||||||
|
entities = entities,
|
||||||
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
|
threadId = threadId,
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyMarkup = replyMarkup,
|
||||||
|
replyParameters = ReplyParameters(
|
||||||
|
messageId = toMessageId,
|
||||||
|
chatIdentifier = toChatId,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
toChatId: IdChatIdentifier,
|
||||||
|
toMessageId: MessageId,
|
||||||
|
starCount: Int,
|
||||||
|
media: List<TelegramPaidMedia>,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
showCaptionAboveMedia: Boolean = false,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) {
|
||||||
|
sendPaidMedia(
|
||||||
|
chatId = toChatId,
|
||||||
|
starCount = starCount,
|
||||||
|
media = media,
|
||||||
|
text = text,
|
||||||
|
parseMode = parseMode,
|
||||||
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
|
threadId = threadId,
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
replyMarkup = replyMarkup,
|
||||||
|
replyParameters = ReplyParameters(
|
||||||
|
messageId = toMessageId,
|
||||||
|
chatIdentifier = toChatId,
|
||||||
|
allowSendingWithoutReply = allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message.payments
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.media.*
|
||||||
|
|
||||||
|
fun PaidMedia.toTelegramPaidMediaOrNull(): TelegramPaidMedia? = when (this) {
|
||||||
|
is PaidMedia.Photo -> toTelegramMediaPhoto()
|
||||||
|
is PaidMedia.Video -> toTelegramPaidMediaVideo()
|
||||||
|
is PaidMedia.Preview, is PaidMedia.Unknown -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun PaidMedia.Video.toTelegramPaidMediaVideo(): TelegramPaidMediaVideo = this.video.toTelegramPaidMediaVideo()
|
||||||
|
|
||||||
|
fun PaidMedia.Photo.toTelegramMediaPhoto(): TelegramPaidMediaPhoto = this.photo.biggest.toTelegramPaidMediaPhoto()
|
Loading…
Reference in New Issue
Block a user