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

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

View File

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

View File

@ -23,6 +23,7 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -39,6 +40,7 @@ suspend fun TelegramBot.sendAnimation(
thumb, thumb,
text, text,
parseMode, parseMode,
spoilered,
duration, duration,
width, width,
height, height,
@ -60,6 +62,7 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile, animation: AnimationFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -70,7 +73,7 @@ suspend fun TelegramBot.sendAnimation(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = 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, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -92,7 +96,7 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, animation: AnimationFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -112,7 +117,7 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, animation: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -139,6 +145,7 @@ suspend fun TelegramBot.sendAnimation(
animation, animation,
thumb, thumb,
entities, entities,
spoilered,
duration, duration,
width, width,
height, height,
@ -159,6 +166,7 @@ suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
animation: AnimationFile, animation: AnimationFile,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -169,7 +177,7 @@ suspend fun TelegramBot.sendAnimation(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = 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, animation: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -190,7 +199,7 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, chat: Chat,
animation: AnimationFile, animation: AnimationFile,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -209,4 +219,4 @@ suspend fun TelegramBot.sendAnimation(
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, fileId: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -34,6 +35,7 @@ suspend fun TelegramBot.sendPhoto(
fileId, fileId,
text, text,
parseMode, parseMode,
spoilered,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
@ -52,13 +54,14 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile, fileId: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, photo: Photo,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, photo: Photo,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, photoSize: PhotoSize,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, photoSize: PhotoSize,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, chatId: ChatIdentifier,
fileId: InputFile, fileId: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -148,6 +156,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId, chatId,
fileId, fileId,
entities, entities,
spoilered,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
@ -165,13 +174,14 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
fileId: InputFile, fileId: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, chatId: ChatIdentifier,
photo: Photo, photo: Photo,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, chat: Chat,
photo: Photo, photo: Photo,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, chatId: ChatIdentifier,
photoSize: PhotoSize, photoSize: PhotoSize,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, chat: Chat,
photoSize: PhotoSize, photoSize: PhotoSize,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -39,6 +40,7 @@ suspend fun TelegramBot.sendVideo(
thumb, thumb,
text, text,
parseMode, parseMode,
spoilered,
duration, duration,
width, width,
height, height,
@ -61,13 +63,14 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile, video: VideoFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -88,7 +92,7 @@ suspend fun TelegramBot.sendVideo(
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, video: VideoFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, video: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -132,6 +138,7 @@ suspend inline fun TelegramBot.sendVideo(
video, video,
thumb, thumb,
entities, entities,
spoilered,
duration, duration,
width, width,
height, height,
@ -153,13 +160,14 @@ suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier, chatId: ChatIdentifier,
video: VideoFile, video: VideoFile,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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 * @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, video: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -179,7 +188,7 @@ suspend inline fun TelegramBot.sendVideo(
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, chat: Chat,
video: VideoFile, video: VideoFile,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -47,6 +48,7 @@ fun SendAnimation(
text, text,
parseMode, parseMode,
null, null,
spoilered,
duration, duration,
width, width,
height, height,
@ -73,6 +75,7 @@ fun SendAnimation(
animation: InputFile, animation: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -95,6 +98,7 @@ fun SendAnimation(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
spoilered,
duration, duration,
width, width,
height, height,
@ -133,6 +137,8 @@ data class SendAnimationData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(durationField) @SerialName(durationField)
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(widthField) @SerialName(widthField)
@ -157,7 +163,8 @@ data class SendAnimationData internal constructor(
TextableSendMessageRequest<ContentMessage<AnimationContent>>, TextableSendMessageRequest<ContentMessage<AnimationContent>>,
ThumbedSendMessageRequest<ContentMessage<AnimationContent>>, ThumbedSendMessageRequest<ContentMessage<AnimationContent>>,
DuratedSendMessageRequest<ContentMessage<AnimationContent>>, DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
SizedSendMessageRequest<ContentMessage<AnimationContent>> SizedSendMessageRequest<ContentMessage<AnimationContent>>,
OptionallyWithSpoilerRequest
{ {
override val textSources: TextSourcesList? by lazy { override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null) rawEntities ?.asTextSources(text ?: return@lazy null)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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