support of has_media_spoiler in message and sendPhoto/sendVideo/sendAnimation

This commit is contained in:
InsanusMokrassar 2022-12-30 20:10:35 +06:00
parent 8df8b87d54
commit febd6ce63c
16 changed files with 173 additions and 61 deletions

View File

@ -379,6 +379,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -392,6 +393,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
thumb,
text,
parseMode,
spoilered,
duration,
width,
height,
@ -408,6 +410,7 @@ suspend inline fun TelegramBot.reply(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -415,12 +418,13 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(to.chat, animation, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
thumb: InputFile? = null,
duration: Long? = null,
width: Int? = null,
@ -434,6 +438,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
animation,
thumb,
entities,
spoilered,
duration,
width,
height,
@ -449,6 +454,7 @@ suspend inline fun TelegramBot.reply(
to: Message,
animation: AnimationFile,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -456,7 +462,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(to.chat, animation, entities, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(to.chat, animation, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Audio
@ -608,64 +614,70 @@ suspend inline fun TelegramBot.replyWithPhoto(
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, fileId, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(to.chat, fileId, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photo, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(to.chat, photo, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photoSize, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(to.chat, photoSize, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
fileId: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, fileId, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(to.chat, fileId, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
photo: Photo,
entities: TextSourcesList,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photo, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(to.chat, photo, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
photoSize: PhotoSize,
entities: TextSourcesList,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photoSize, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(to.chat, photoSize, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Sticker
@ -697,6 +709,7 @@ suspend inline fun TelegramBot.replyWithVideo(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -704,24 +717,26 @@ suspend inline fun TelegramBot.replyWithVideo(
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(to.chat, video, thumb, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(to.chat, video, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -729,17 +744,18 @@ suspend inline fun TelegramBot.replyWithVideo(
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, thumb, entities, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(to.chat, video, thumb, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
video: VideoFile,
entities: TextSourcesList,
spoilered: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(to.chat, video, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// VideoNotes

View File

@ -56,6 +56,7 @@ suspend fun TelegramBot.send(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -65,7 +66,7 @@ suspend fun TelegramBot.send(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chatId, animation, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chatId, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendAnimation] request
@ -77,6 +78,7 @@ suspend fun TelegramBot.send(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -86,7 +88,7 @@ suspend fun TelegramBot.send(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat, animation, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendAnimation] request
@ -97,6 +99,7 @@ suspend fun TelegramBot.send(
chatId: ChatIdentifier,
animation: AnimationFile,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -106,7 +109,7 @@ suspend fun TelegramBot.send(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chatId, animation, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chatId, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendAnimation] request
@ -117,6 +120,7 @@ suspend fun TelegramBot.send(
chat: Chat,
animation: AnimationFile,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -126,7 +130,7 @@ suspend fun TelegramBot.send(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat, animation, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendAudio] request
@ -688,13 +692,14 @@ suspend fun TelegramBot.send(
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -706,13 +711,14 @@ suspend fun TelegramBot.send(
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat, photo, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -724,13 +730,14 @@ suspend fun TelegramBot.send(
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -742,13 +749,14 @@ suspend fun TelegramBot.send(
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat, photoSize, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -759,13 +767,14 @@ suspend inline fun TelegramBot.send(
chatId: ChatIdentifier,
photo: Photo,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photo, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -776,13 +785,14 @@ suspend inline fun TelegramBot.send(
chat: Chat,
photo: Photo,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat, photo, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat, photo, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -793,13 +803,14 @@ suspend inline fun TelegramBot.send(
chatId: ChatIdentifier,
photoSize: PhotoSize,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendPhoto] request
@ -810,13 +821,14 @@ suspend inline fun TelegramBot.send(
chat: Chat,
photoSize: PhotoSize,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat, photoSize, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendRegularPoll] request
@ -1357,13 +1369,14 @@ suspend fun TelegramBot.send(
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chatId, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendVideo] request
@ -1375,13 +1388,14 @@ suspend fun TelegramBot.send(
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat, video, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendVideo] request
@ -1392,13 +1406,14 @@ suspend inline fun TelegramBot.send(
chatId: ChatIdentifier,
video: VideoFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chatId, video, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendVideo] request
@ -1409,13 +1424,14 @@ suspend inline fun TelegramBot.send(
chat: Chat,
video: VideoFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat, video, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat, video, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* Will execute [sendVideoNote] request

View File

@ -23,6 +23,7 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -39,6 +40,7 @@ suspend fun TelegramBot.sendAnimation(
thumb,
text,
parseMode,
spoilered,
duration,
width,
height,
@ -60,6 +62,7 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -70,7 +73,7 @@ suspend fun TelegramBot.sendAnimation(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
@ -83,6 +86,7 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -92,7 +96,7 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -103,6 +107,7 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -112,7 +117,7 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
@ -124,6 +129,7 @@ suspend fun TelegramBot.sendAnimation(
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -139,6 +145,7 @@ suspend fun TelegramBot.sendAnimation(
animation,
thumb,
entities,
spoilered,
duration,
width,
height,
@ -159,6 +166,7 @@ suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -169,7 +177,7 @@ suspend fun TelegramBot.sendAnimation(
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumb ?.fileId, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, animation.fileId, animation.thumb ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
@ -181,6 +189,7 @@ suspend fun TelegramBot.sendAnimation(
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -190,7 +199,7 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -200,6 +209,7 @@ suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: AnimationFile,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -209,4 +219,4 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -22,6 +22,7 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@ -34,6 +35,7 @@ suspend fun TelegramBot.sendPhoto(
fileId,
text,
parseMode,
spoilered,
threadId,
disableNotification,
protectContent,
@ -52,13 +54,14 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -69,13 +72,14 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -86,13 +90,14 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -103,13 +108,14 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -120,13 +126,14 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
@ -137,6 +144,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
fileId: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@ -148,6 +156,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId,
fileId,
entities,
spoilered,
threadId,
disableNotification,
protectContent,
@ -165,13 +174,14 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
fileId: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -181,13 +191,14 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photo: Photo,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -197,13 +208,14 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photo: Photo,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photo, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -213,13 +225,14 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photoSize: PhotoSize,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -229,10 +242,11 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photoSize: PhotoSize,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -23,6 +23,7 @@ suspend fun TelegramBot.sendVideo(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -39,6 +40,7 @@ suspend fun TelegramBot.sendVideo(
thumb,
text,
parseMode,
spoilered,
duration,
width,
height,
@ -61,13 +63,14 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -79,6 +82,7 @@ suspend fun TelegramBot.sendVideo(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -88,7 +92,7 @@ suspend fun TelegramBot.sendVideo(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
@ -100,13 +104,14 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -117,6 +122,7 @@ suspend inline fun TelegramBot.sendVideo(
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -132,6 +138,7 @@ suspend inline fun TelegramBot.sendVideo(
video,
thumb,
entities,
spoilered,
duration,
width,
height,
@ -153,13 +160,14 @@ suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -170,6 +178,7 @@ suspend inline fun TelegramBot.sendVideo(
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -179,7 +188,7 @@ suspend inline fun TelegramBot.sendVideo(
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
@ -190,10 +199,11 @@ suspend inline fun TelegramBot.sendVideo(
chat: Chat,
video: VideoFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.requests.send.abstracts
interface OptionallyWithSpoilerRequest {
val spoilered: Boolean
}

View File

@ -25,6 +25,7 @@ fun SendAnimation(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -47,6 +48,7 @@ fun SendAnimation(
text,
parseMode,
null,
spoilered,
duration,
width,
height,
@ -73,6 +75,7 @@ fun SendAnimation(
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -95,6 +98,7 @@ fun SendAnimation(
entities.makeString(),
null,
entities.toRawMessageEntities(),
spoilered,
duration,
width,
height,
@ -133,6 +137,8 @@ data class SendAnimationData internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(durationField)
override val duration: Long? = null,
@SerialName(widthField)
@ -157,7 +163,8 @@ data class SendAnimationData internal constructor(
TextableSendMessageRequest<ContentMessage<AnimationContent>>,
ThumbedSendMessageRequest<ContentMessage<AnimationContent>>,
DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
SizedSendMessageRequest<ContentMessage<AnimationContent>>
SizedSendMessageRequest<ContentMessage<AnimationContent>>,
OptionallyWithSpoilerRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)

View File

@ -23,6 +23,7 @@ fun SendPhoto(
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@ -36,6 +37,7 @@ fun SendPhoto(
text,
parseMode,
null,
spoilered,
threadId,
disableNotification,
protectContent,
@ -55,6 +57,7 @@ fun SendPhoto(
chatId: ChatIdentifier,
photo: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@ -68,6 +71,7 @@ fun SendPhoto(
entities.makeString(),
null,
entities.toRawMessageEntities(),
spoilered,
threadId,
disableNotification,
protectContent,
@ -98,6 +102,8 @@ data class SendPhotoData internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(disableNotificationField)
@ -113,7 +119,8 @@ data class SendPhotoData internal constructor(
) : DataRequest<ContentMessage<PhotoContent>>,
SendMessageRequest<ContentMessage<PhotoContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
TextableSendMessageRequest<ContentMessage<PhotoContent>>
TextableSendMessageRequest<ContentMessage<PhotoContent>>,
OptionallyWithSpoilerRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)

View File

@ -25,6 +25,7 @@ fun SendVideo(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -48,6 +49,7 @@ fun SendVideo(
text,
parseMode,
null,
spoilered,
duration,
width,
height,
@ -75,6 +77,7 @@ fun SendVideo(
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
@ -98,6 +101,7 @@ fun SendVideo(
entities.makeString(),
null,
entities.toRawMessageEntities(),
spoilered,
duration,
width,
height,
@ -137,6 +141,8 @@ data class SendVideoData internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(durationField)
override val duration: Long? = null,
@SerialName(widthField)
@ -163,7 +169,8 @@ data class SendVideoData internal constructor(
TextableSendMessageRequest<ContentMessage<VideoContent>>,
ThumbedSendMessageRequest<ContentMessage<VideoContent>>,
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
SizedSendMessageRequest<ContentMessage<VideoContent>>
SizedSendMessageRequest<ContentMessage<VideoContent>>,
OptionallyWithSpoilerRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)

View File

@ -228,6 +228,7 @@ const val allowsMultipleAnswersField = "allows_multiple_answers"
const val isAnonymousField = "is_anonymous"
const val canManageTopicsField = "can_manage_topics"
const val captionEntitiesField = "caption_entities"
const val hasSpoilerField = "has_spoiler"
const val loginUrlField = "login_url"
const val forwardTextField = "forward_text"
const val botUsernameField = "bot_username"

View File

@ -58,6 +58,7 @@ internal data class RawMessage(
private val entities: RawMessageEntities? = null,
private val caption: String? = null,
private val caption_entities: RawMessageEntities? = null,
private val has_media_spoiler: Boolean? = null,
private val audio: AudioFile? = null,
private val document: DocumentFile? = null,
private val animation: AnimationFile? = null,
@ -129,13 +130,15 @@ internal data class RawMessage(
video != null -> VideoContent(
video,
caption,
adaptedCaptionEntities
adaptedCaptionEntities,
has_media_spoiler ?: false
)
animation != null -> AnimationContent(
animation,
document,
caption,
adaptedCaptionEntities
adaptedCaptionEntities,
has_media_spoiler ?: false
)
document != null -> DocumentContent(
document,
@ -150,7 +153,8 @@ internal data class RawMessage(
photo != null -> PhotoContent(
photo.toList(),
caption,
adaptedCaptionEntities
adaptedCaptionEntities,
has_media_spoiler ?: false
)
sticker != null -> StickerContent(sticker)
dice != null -> DiceContent(dice)

View File

@ -23,6 +23,7 @@ sealed interface MessageContent: ResendableContent {
mediaGroupPartContentAdditionalBuilder: PolymorphicModuleBuilder<MediaGroupPartContent>.() -> Unit = {},
textedMediaContentAdditionalBuilder: PolymorphicModuleBuilder<TextedMediaContent>.() -> Unit = {},
mediaContentAdditionalBuilder: PolymorphicModuleBuilder<MediaContent>.() -> Unit = {},
spoilerableMediaContentAdditionalBuilder: PolymorphicModuleBuilder<SpoilerableMediaContent>.() -> Unit = {},
mediaCollectionContentAdditionalBuilder: PolymorphicModuleBuilder<MediaCollectionContent<*>>.() -> Unit = {},
additionalBuilder: PolymorphicModuleBuilder<MessageContent>.() -> Unit = {}
) = SerializersModule {
@ -66,6 +67,13 @@ sealed interface MessageContent: ResendableContent {
mediaContentAdditionalBuilder()
}
polymorphic(SpoilerableMediaContent::class) {
subclass(VideoContent::class)
subclass(PhotoContent::class)
subclass(AnimationContent::class)
spoilerableMediaContentAdditionalBuilder()
}
polymorphic(TextedMediaContent::class) {
subclass(PhotoContent::class)
subclass(VoiceContent::class)
@ -111,6 +119,10 @@ sealed interface MediaContent: MessageContent {
fun asTelegramMedia(): TelegramMedia
}
sealed interface SpoilerableMediaContent : MediaContent {
val spoilered: Boolean
}
@ClassCastsIncluded
sealed interface ResendableContent {
fun createResend(

View File

@ -39,6 +39,6 @@ sealed interface MediaGroupPartContent : TextedMediaContent {
fun toMediaGroupMemberTelegramMedia(): MediaGroupMemberTelegramMedia
}
sealed interface VisualMediaGroupPartContent : MediaGroupPartContent {
sealed interface VisualMediaGroupPartContent : MediaGroupPartContent, SpoilerableMediaContent {
override fun toMediaGroupMemberTelegramMedia(): VisualMediaGroupMemberTelegramMedia
}

View File

@ -18,8 +18,9 @@ data class AnimationContent(
override val media: AnimationFile,
val includedDocument: DocumentFile?,
override val text: String?,
override val textSources: TextSourcesList = emptyList()
) : TextedMediaContent {
override val textSources: TextSourcesList = emptyList(),
override val spoilered: Boolean = false
) : TextedMediaContent, SpoilerableMediaContent {
override fun createResend(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId?,

View File

@ -17,7 +17,8 @@ import kotlinx.serialization.Serializable
data class PhotoContent(
override val mediaCollection: Photo,
override val text: String? = null,
override val textSources: TextSourcesList = emptyList()
override val textSources: TextSourcesList = emptyList(),
override val spoilered: Boolean = false
) : MediaCollectionContent<PhotoSize>, VisualMediaGroupPartContent {
override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content")

View File

@ -17,7 +17,8 @@ import kotlinx.serialization.Serializable
data class VideoContent(
override val media: VideoFile,
override val text: String? = null,
override val textSources: TextSourcesList = emptyList()
override val textSources: TextSourcesList = emptyList(),
override val spoilered: Boolean = false
) : VisualMediaGroupPartContent {
override fun createResend(
chatId: ChatIdentifier,