1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-29 09:29:23 +00:00

Compare commits

...

11 Commits

105 changed files with 2169 additions and 826 deletions

View File

@@ -1,5 +1,10 @@
# TelegramBotAPI changelog
## 14.0.0
* `Core`:
* `TelegramPaymentChargeId` has been added as value class and replaced raw strings in `SuccessfulPayment` type of `telegramPaymentChargeId`
## 13.0.0
**Add support of [Telegram Bots API 7.3](https://core.telegram.org/bots/api-changelog#may-6-2024)**

View File

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=13.0.0
library_version=14.0.0

View File

@@ -24,9 +24,10 @@ suspend fun TelegramBot.editMessageCaption(
messageId: MessageId,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageCaption(chatId, messageId, text, parseMode, replyMarkup)
EditChatMessageCaption(chatId, messageId, text, parseMode, showCaptionAboveMedia, replyMarkup)
)
/**
@@ -38,8 +39,9 @@ suspend fun TelegramBot.editMessageCaption(
messageId: MessageId,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup)
) = editMessageCaption(chat.id, messageId, text, parseMode, showCaptionAboveMedia, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -49,10 +51,11 @@ suspend fun <T> TelegramBot.editMessageCaption(
message: ContentMessage<T>,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
@Suppress("UNCHECKED_CAST")
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup) as ContentMessage<T>
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, showCaptionAboveMedia, replyMarkup) as ContentMessage<T>
}
/**
@@ -63,9 +66,10 @@ suspend fun TelegramBot.editMessageCaption(
chatId: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageCaption(chatId, messageId, entities, replyMarkup)
EditChatMessageCaption(chatId, messageId, entities, showCaptionAboveMedia, replyMarkup)
)
/**
@@ -76,8 +80,9 @@ suspend fun TelegramBot.editMessageCaption(
chat: Chat,
messageId: MessageId,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageCaption(chat.id, messageId, entities, replyMarkup)
) = editMessageCaption(chat.id, messageId, entities, showCaptionAboveMedia, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -86,10 +91,11 @@ suspend fun TelegramBot.editMessageCaption(
suspend fun <T> TelegramBot.editMessageCaption(
message: ContentMessage<T>,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
@Suppress("UNCHECKED_CAST")
return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup) as ContentMessage<T>
return editMessageCaption(message.chat.id, message.messageId, entities, showCaptionAboveMedia, replyMarkup) as ContentMessage<T>
}
/**
@@ -100,7 +106,8 @@ suspend fun <T> TelegramBot.editMessageCaption(
suspend fun <T> TelegramBot.editMessageCaption(
message: AccessibleMessage,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup)
return editMessageCaption(message.chat.id, message.messageId, entities, showCaptionAboveMedia, replyMarkup)
}

View File

@@ -19,9 +19,10 @@ suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, linkPreviewOptions, replyMarkup))
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup))
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -30,9 +31,10 @@ suspend fun TelegramBot.editMessageText(
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageText(inlineMessageId, entities, linkPreviewOptions, replyMarkup))
) = execute(EditInlineMessageText(inlineMessageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup))
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -41,10 +43,11 @@ suspend fun TelegramBot.editMessageText(
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId,
separator: TextSource? = null,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -53,7 +56,8 @@ suspend fun TelegramBot.editMessageText(
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId,
separator: String,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)

View File

@@ -19,6 +19,7 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -31,6 +32,7 @@ suspend inline fun TelegramBot.copyMessage(
toChatId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -49,12 +51,13 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -66,12 +69,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -83,12 +87,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -100,6 +105,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
toChatId: ChatIdentifier,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -111,6 +117,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId,
toChatId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -128,12 +135,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
toChatId: ChatIdentifier,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChatId, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -144,12 +152,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
toChat: Chat,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(fromChatId, messageId, toChat.id, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -160,12 +169,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
toChat: Chat,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChat.id, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -176,12 +186,13 @@ suspend inline fun TelegramBot.copyMessage(
message: AccessibleMessage,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -192,12 +203,13 @@ suspend inline fun TelegramBot.copyMessage(
message: AccessibleMessage,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -207,12 +219,13 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: AccessibleMessage,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChatId, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -222,12 +235,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
message: AccessibleMessage,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChat, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -239,6 +253,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -251,6 +266,7 @@ suspend inline fun TelegramBot.copyMessage(
toChatId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -269,6 +285,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -280,6 +297,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -297,6 +315,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -308,6 +327,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -325,6 +345,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -336,6 +357,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -353,6 +375,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -364,6 +387,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId,
toChatId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -381,6 +405,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -391,6 +416,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat.id,
messageId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -407,6 +433,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -417,6 +444,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId,
messageId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
@@ -433,6 +461,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -443,6 +472,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat.id,
messageId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,

View File

@@ -1430,7 +1430,7 @@ suspend fun TelegramBot.reply(
replyInThreadId,
replyInBusinessConnectionId,
disableNotification,
protectContent,
protectContent,,
ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true),
replyMarkup
)

View File

@@ -1499,7 +1499,7 @@ suspend fun TelegramBot.reply(
replyInThreadId,
replyInBusinessConnectionId,
disableNotification,
protectContent,
protectContent,,
ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
)

View File

@@ -23,7 +23,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId = chatId,
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
protectContent = protectContent,,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -21,6 +21,7 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -33,21 +34,22 @@ suspend fun TelegramBot.sendAnimation(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAnimation(
chatId,
animation,
thumb,
text,
parseMode,
spoilered,
duration,
width,
height,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
animation = animation,
thumbnail = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -60,6 +62,7 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -71,7 +74,22 @@ suspend fun TelegramBot.sendAnimation(
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup
chatId = chatId,
animation = animation.fileId,
thumb = animation.thumbnail ?.fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -84,6 +102,7 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -94,7 +113,24 @@ suspend fun TelegramBot.sendAnimation(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendAnimation(
chatId = chat.id,
animation = animation,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -105,6 +141,7 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -115,7 +152,23 @@ suspend fun TelegramBot.sendAnimation(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendAnimation(
chatId = chat.id,
animation = animation,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -127,6 +180,7 @@ suspend fun TelegramBot.sendAnimation(
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -139,20 +193,21 @@ suspend fun TelegramBot.sendAnimation(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAnimation(
chatId,
animation,
thumb,
entities,
spoilered,
duration,
width,
height,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
animation = animation,
thumbnail = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -164,6 +219,7 @@ suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -175,7 +231,21 @@ suspend fun TelegramBot.sendAnimation(
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup
chatId = chatId,
animation = animation.fileId,
thumb = animation.thumbnail ?.fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -187,6 +257,7 @@ suspend fun TelegramBot.sendAnimation(
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -197,7 +268,23 @@ suspend fun TelegramBot.sendAnimation(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendAnimation(
chatId = chat.id,
animation = animation,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -207,6 +294,7 @@ suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: AnimationFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -217,4 +305,19 @@ suspend fun TelegramBot.sendAnimation(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendAnimation(
chatId = chat.id,
animation = animation,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -20,6 +20,7 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -29,17 +30,18 @@ suspend fun TelegramBot.sendPhoto(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPhoto(
chatId,
fileId,
text,
parseMode,
spoilered,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
photo = fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -52,6 +54,7 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -59,7 +62,20 @@ suspend fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chat.id,
fileId = fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -70,6 +86,7 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -77,7 +94,20 @@ suspend fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chatId,
fileId = photo.biggest() ?.fileId ?: error("Photo content must not be empty"),
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -88,6 +118,7 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -95,7 +126,20 @@ suspend fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chat.id,
photo = photo,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -106,6 +150,7 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -113,7 +158,20 @@ suspend fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chatId,
fileId = photoSize.fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -124,6 +182,7 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -131,7 +190,20 @@ suspend fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chat.id,
photoSize = photoSize,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -142,6 +214,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
fileId: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -151,16 +224,17 @@ suspend inline fun TelegramBot.sendPhoto(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPhoto(
chatId,
fileId,
entities,
spoilered,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
photo = fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -172,6 +246,7 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
fileId: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -179,7 +254,19 @@ suspend inline fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chat.id,
fileId = fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -189,6 +276,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photo: Photo,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -196,7 +284,19 @@ suspend inline fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chatId,
fileId = photo.biggest() ?.fileId ?: error("Photo content must not be empty"),
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -206,6 +306,7 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photo: Photo,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -213,7 +314,19 @@ suspend inline fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, entities, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chat.id,
photo = photo,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -223,6 +336,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photoSize: PhotoSize,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -230,7 +344,19 @@ suspend inline fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chatId,
fileId = photoSize.fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -240,6 +366,7 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photoSize: PhotoSize,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -247,4 +374,16 @@ suspend inline fun TelegramBot.sendPhoto(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendPhoto(
chatId = chat.id,
photoSize = photoSize,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -21,6 +21,7 @@ suspend fun TelegramBot.sendVideo(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -33,22 +34,23 @@ suspend fun TelegramBot.sendVideo(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideo(
chatId,
video,
thumb,
text,
parseMode,
spoilered,
duration,
width,
height,
null,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
video = video,
thumbnail = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
supportStreaming = null,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -61,6 +63,7 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -68,7 +71,24 @@ suspend fun TelegramBot.sendVideo(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendVideo(
chatId = chatId,
video = video.fileId,
thumb = video.thumbnail ?.fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = video.duration,
width = video.width,
height = video.height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -80,6 +100,7 @@ suspend fun TelegramBot.sendVideo(
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -90,7 +111,24 @@ suspend fun TelegramBot.sendVideo(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendVideo(
chatId = chat.id,
video = video,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -102,6 +140,7 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -109,7 +148,20 @@ suspend fun TelegramBot.sendVideo(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendVideo(
chatId = chat.id,
video = video,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -120,6 +172,7 @@ suspend inline fun TelegramBot.sendVideo(
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -132,21 +185,22 @@ suspend inline fun TelegramBot.sendVideo(
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideo(
chatId,
video,
thumb,
entities,
spoilered,
duration,
width,
height,
null,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
video = video,
thumbnail = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
supportStreaming = null,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -158,6 +212,7 @@ suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@@ -165,7 +220,23 @@ suspend inline fun TelegramBot.sendVideo(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendVideo(
chatId = chatId,
video = video.fileId,
thumb = video.thumbnail ?.fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = video.duration,
width = video.width,
height = video.height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -176,6 +247,7 @@ suspend inline fun TelegramBot.sendVideo(
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -186,7 +258,23 @@ suspend inline fun TelegramBot.sendVideo(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendVideo(
chatId = chat.id,
video = video,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -197,6 +285,7 @@ suspend inline fun TelegramBot.sendVideo(
chat: Chat,
video: VideoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
@@ -204,4 +293,16 @@ suspend inline fun TelegramBot.sendVideo(
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, entities, spoilered, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = sendVideo(
chatId = chat.id,
video = video,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
suspend fun TelegramBot.createInvoiceLink(
title: String,
@@ -29,3 +30,25 @@ suspend fun TelegramBot.createInvoiceLink(
) = execute(
CreateInvoiceLink(title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress)
)
/**
* For links witn XTR currency and using of Telegram Stars
*/
suspend fun TelegramBot.createInvoiceLink(
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false
) = execute(
CreateInvoiceLink(title, description, payload, null, Currency.XTR, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress)
)

View File

@@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.extensions.api.send.payments
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.payments.RefundStarPayment
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
import dev.inmo.tgbotapi.types.payments.abstracts.TelegramPaymentChargeId
suspend fun TelegramBot.refundStarPayment(
userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId
) = execute(RefundStarPayment(userId, telegramPaymentChargeId))
suspend fun TelegramBot.refundStarPayment(
userId: UserId,
successfulPayment: SuccessfulPayment
) = refundStarPayment(userId, successfulPayment.telegramPaymentChargeId)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -68,3 +69,61 @@ suspend fun TelegramBot.sendInvoice(
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.sendInvoice(
chatId: IdChatIdentifier,
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
startParameter: StartParameter? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
SendInvoice(chatId, title, description, payload, null, Currency.XTR, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.sendInvoice(
user: CommonUser,
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
startParameter: StartParameter? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.payments.abstracts.Priced
interface CommonSendInvoiceData : Titled, Currencied, Priced {
val description: String
val payload: String
val providerToken: String
val providerToken: String?
val maxTipAmount: Int?
val suggestedTipAmounts: List<Int>?
val providerData: String?

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.abstracts
interface WithCustomizableCaption : Texted {
val showCaptionAboveMedia: Boolean
}

View File

@@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.EffectId
interface OptionallyWithEffectId {
val effectId: EffectId?
}

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.edit.caption
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer
import dev.inmo.tgbotapi.requests.send.abstracts.WithCustomizableCaptionRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
@@ -22,28 +23,32 @@ fun EditChatMessageCaption(
messageId: MessageId,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
) = EditChatMessageCaption(
chatId,
messageId,
text,
parseMode,
null,
replyMarkup
chatId = chatId,
messageId = messageId,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
fun EditChatMessageCaption(
chatId: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
) = EditChatMessageCaption(
chatId,
messageId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup
chatId = chatId,
messageId = messageId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
@Serializable
@@ -58,9 +63,11 @@ data class EditChatMessageCaption internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<MediaContent>, EditTextChatMessage, EditReplyMessage {
) : EditChatMessage<MediaContent>, WithCustomizableCaptionRequest<ContentMessage<MediaContent>>, EditTextChatMessage, EditReplyMessage {
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text)
}

View File

@@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.requests.edit.text
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.requests.send.abstracts.WithCustomizableCaptionRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
@@ -16,29 +17,33 @@ fun EditInlineMessageText(
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditInlineMessageText(
inlineMessageId,
text,
parseMode,
null,
linkPreviewOptions,
replyMarkup
inlineMessageId = inlineMessageId,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
fun EditInlineMessageText(
inlineMessageId: InlineMessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditInlineMessageText(
inlineMessageId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
linkPreviewOptions,
replyMarkup
inlineMessageId = inlineMessageId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
@Serializable
@@ -51,11 +56,13 @@ data class EditInlineMessageText internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(entitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditLinkPreviewOptionsContainer {
) : EditInlineMessage, WithCustomizableCaptionRequest<Boolean>, EditTextChatMessage, EditReplyMessage, EditLinkPreviewOptionsContainer {
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text)
}

View File

@@ -1,11 +1,13 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
import dev.inmo.tgbotapi.abstracts.types.MessageAction
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.WithCustomizableCaptionRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSource
@@ -28,23 +30,25 @@ fun CopyMessage(
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
fromChatId,
messageId,
text,
parseMode,
null,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
toChatId = toChatId,
fromChatId = fromChatId,
messageId = messageId,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
fun CopyMessage(
@@ -52,23 +56,25 @@ fun CopyMessage(
fromChatId: ChatIdentifier,
messageId: MessageId,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
fromChatId,
messageId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
toChatId = toChatId,
fromChatId = fromChatId,
messageId = messageId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
fun CopyMessage(
@@ -77,23 +83,25 @@ fun CopyMessage(
toChatId: ChatIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
fromChatId,
messageId,
text,
parseMode,
null,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
toChatId = toChatId,
fromChatId = fromChatId,
messageId = messageId,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
fun CopyMessage(
@@ -101,23 +109,25 @@ fun CopyMessage(
messageId: MessageId,
toChatId: ChatIdentifier,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
fromChatId,
messageId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
toChatId = toChatId,
fromChatId = fromChatId,
messageId = messageId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@Serializable
@@ -134,6 +144,8 @@ data class CopyMessage internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = toChatId.threadId,
@SerialName(disableNotificationField)
@@ -146,6 +158,7 @@ data class CopyMessage internal constructor(
override val replyMarkup: KeyboardMarkup? = null
): SimpleRequest<MessageId>,
ReplyingMarkupSendMessageRequest<MessageId>,
WithCustomizableCaptionRequest<MessageId>,
MessageAction,
TextedOutput,
ProtectContent,

View File

@@ -32,6 +32,8 @@ data class SendContact(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -46,6 +48,7 @@ data class SendContact(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): this(
@@ -57,6 +60,7 @@ data class SendContact(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -74,15 +78,17 @@ fun Contact.toRequest(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): SendContact = SendContact(
chatId,
this,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
contact = this,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.types.DisableNotification
import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest
import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@@ -30,11 +31,13 @@ data class SendDice(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, WithReplyParameters, DisableNotification,
) : SendContentMessageRequest<ContentMessage<DiceContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, WithReplyParameters, DisableNotification,
OptionallyBusinessConnectionRequest {
override val requestSerializer: SerializationStrategy<*>
get() = serializer()

View File

@@ -23,6 +23,7 @@ fun SendLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(
@@ -37,6 +38,7 @@ fun SendLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -49,9 +51,21 @@ fun SendStaticLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
) = SendLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
fun SendLiveLocation(
chatId: ChatIdentifier,
@@ -65,22 +79,24 @@ fun SendLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(
chatId,
latitude,
longitude,
livePeriod,
horizontalAccuracy,
heading,
proximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@Serializable
@@ -107,6 +123,8 @@ data class SendLocation internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -30,6 +30,7 @@ fun SendTextMessage(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendTextMessage(
@@ -42,6 +43,7 @@ fun SendTextMessage(
linkPreviewOptions,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -54,6 +56,7 @@ fun SendTextMessage(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendTextMessage(
@@ -66,6 +69,7 @@ fun SendTextMessage(
linkPreviewOptions,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -90,6 +94,8 @@ data class SendTextMessage internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -41,6 +41,8 @@ data class SendVenue(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -57,6 +59,7 @@ data class SendVenue(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): this(
@@ -70,8 +73,10 @@ data class SendVenue(
googlePlaceId = venue.googlePlaceId,
googlePlaceType = venue.googlePlaceType,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -89,6 +94,7 @@ fun Venue.toRequest(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): SendVenue = SendVenue(
@@ -98,6 +104,7 @@ fun Venue.toRequest(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)

View File

@@ -0,0 +1,6 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.OptionallyWithEffectId
import dev.inmo.tgbotapi.requests.abstracts.Request
interface OptionallyWithEffectRequest<T : Any> : OptionallyWithEffectId, Request<T>

View File

@@ -2,4 +2,4 @@ package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest
interface SendContentMessageRequest<T: Any> : SendMessageRequest<T>, OptionallyBusinessConnectionRequest
interface SendContentMessageRequest<T: Any> : SendMessageRequest<T>, OptionallyBusinessConnectionRequest, OptionallyWithEffectRequest<T>

View File

@@ -0,0 +1,6 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
import dev.inmo.tgbotapi.requests.abstracts.Request
interface WithCustomizableCaptionRequest<T : Any> : Request<T>, WithCustomizableCaption

View File

@@ -28,6 +28,8 @@ data class SendGame (
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -27,6 +27,7 @@ fun SendAnimation(
thumbnail: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -35,6 +36,7 @@ fun SendAnimation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> {
@@ -42,22 +44,24 @@ fun SendAnimation(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendAnimationData(
chatId,
animation,
thumbnail ?.fileId,
text,
parseMode,
null,
spoilered,
duration,
width,
height,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
animation = animation,
thumbnail = thumbnail ?.fileId,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (animationAsFile == null && thumbAsFile == null) {
@@ -75,6 +79,7 @@ fun SendAnimation(
animation: InputFile,
thumbnail: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -83,6 +88,7 @@ fun SendAnimation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> {
@@ -90,22 +96,24 @@ fun SendAnimation(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendAnimationData(
chatId,
animation,
thumbnail ?.fileId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
spoilered,
duration,
width,
height,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
animation = animation,
thumbnail = thumbnail ?.fileId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (animationAsFile == null && thumbAsFile == null) {
@@ -135,6 +143,8 @@ data class SendAnimationData internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(durationField)
@@ -151,6 +161,8 @@ data class SendAnimationData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -162,6 +174,7 @@ data class SendAnimationData internal constructor(
ThumbedSendMessageRequest<ContentMessage<AnimationContent>>,
DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
SizedSendMessageRequest<ContentMessage<AnimationContent>>,
WithCustomizableCaptionRequest<ContentMessage<AnimationContent>>,
OptionallyWithSpoilerRequest
{
override val textSources: TextSourcesList? by lazy {

View File

@@ -35,6 +35,7 @@ fun SendAudio(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AudioContent>> {
@@ -42,21 +43,22 @@ fun SendAudio(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendAudioData(
chatId,
audio,
thumbnail ?.fileId,
text,
parseMode,
null,
duration,
performer,
title,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
audio = audio,
thumbnail = thumbnail ?.fileId,
text = text,
parseMode = parseMode,
rawEntities = null,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (audioAsFile == null && thumbAsFile == null) {
@@ -81,6 +83,7 @@ fun SendAudio(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AudioContent>> {
@@ -88,21 +91,22 @@ fun SendAudio(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendAudioData(
chatId,
audio,
thumbnail ?.fileId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
duration,
performer,
title,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
audio = audio,
thumbnail = thumbnail ?.fileId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
duration = duration,
performer = performer,
title = title,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (audioAsFile == null && thumbAsFile == null) {
@@ -146,6 +150,8 @@ data class SendAudioData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -40,6 +40,7 @@ fun SendDocument(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
@@ -48,19 +49,20 @@ fun SendDocument(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendDocumentData(
chatId,
document,
thumbnail ?.fileId,
text,
parseMode,
null,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup,
disableContentTypeDetection
chatId = chatId,
document = document,
thumbnail = thumbnail ?.fileId,
text = text,
parseMode = parseMode,
rawEntities = null,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
return if (documentAsFile == null && thumbAsFile == null) {
@@ -91,6 +93,7 @@ fun SendDocument(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
@@ -99,19 +102,20 @@ fun SendDocument(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendDocumentData(
chatId,
document,
thumbnail ?.fileId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup,
disableContentTypeDetection
chatId = chatId,
document = document,
thumbnail = thumbnail ?.fileId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
return if (documentAsFile == null && thumbAsFile == null) {
@@ -158,6 +162,8 @@ data class SendDocumentData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -37,8 +37,8 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null
): Request<ContentMessage<MediaGroupContent<T>>> {
if (media.size !in mediaCountInMediaGroup) {
throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size)
@@ -56,13 +56,14 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
}
val data = SendMediaGroupData(
chatId,
media,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters
chatId = chatId,
media = media,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters
)
return (if (files.isEmpty()) {
@@ -88,9 +89,18 @@ inline fun SendPlaylist(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<AudioContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null
) = SendMediaGroup<AudioContent>(
chatId = chatId,
media = media,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters
)
/**
* Use this method to be sure that you are correctly sending documents media group
@@ -105,9 +115,18 @@ inline fun SendDocumentsGroup(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<DocumentContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null
) = SendMediaGroup<DocumentContent>(
chatId = chatId,
media = media,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters
)
/**
* Use this method to be sure that you are correctly sending visual media group
@@ -123,9 +142,18 @@ inline fun SendVisualMediaGroup(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
) = SendMediaGroup<VisualMediaGroupPartContent>(
chatId = chatId,
media = media,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters
)
private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>())
@@ -155,6 +183,8 @@ data class SendMediaGroupData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>,

View File

@@ -25,27 +25,31 @@ fun SendPhoto(
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> {
val data = SendPhotoData(
chatId,
photo,
text,
parseMode,
null,
spoilered,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
photo = photo,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (photo is MultipartFile) {
CommonMultipartFileRequest(
@@ -61,27 +65,31 @@ fun SendPhoto(
chatId: ChatIdentifier,
photo: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> {
val data = SendPhotoData(
chatId,
photo,
entities.makeString(),
null,
entities.toRawMessageEntities(),
spoilered,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
photo = photo,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (photo is MultipartFile) {
@@ -109,6 +117,8 @@ data class SendPhotoData internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(messageThreadIdField)
@@ -119,6 +129,8 @@ data class SendPhotoData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -127,6 +139,7 @@ data class SendPhotoData internal constructor(
SendContentMessageRequest<ContentMessage<PhotoContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
TextableSendMessageRequest<ContentMessage<PhotoContent>>,
WithCustomizableCaptionRequest<ContentMessage<PhotoContent>>,
OptionallyWithSpoilerRequest
{
override val textSources: TextSourcesList? by lazy {

View File

@@ -18,20 +18,21 @@ fun SendSticker(
sticker: InputFile,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
chatId,
sticker,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
sticker = sticker,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
).let {
when (sticker) {
is MultipartFile -> CommonMultipartFileRequest(
@@ -59,6 +60,8 @@ data class SendStickerByFileId internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -27,6 +27,7 @@ fun SendVideo(
thumbnail: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -36,6 +37,7 @@ fun SendVideo(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> {
@@ -43,23 +45,25 @@ fun SendVideo(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendVideoData(
chatId,
video,
thumbnail ?.fileId,
text,
parseMode,
null,
spoilered,
duration,
width,
height,
supportStreaming,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
video = video,
thumbnail = thumbnail ?.fileId,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
supportStreaming = supportStreaming,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (videoAsFile == null && thumbAsFile == null) {
@@ -77,6 +81,7 @@ fun SendVideo(
video: InputFile,
thumbnail: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
@@ -86,6 +91,7 @@ fun SendVideo(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> {
@@ -93,23 +99,25 @@ fun SendVideo(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendVideoData(
chatId,
video,
thumbnail ?.fileId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
spoilered,
duration,
width,
height,
supportStreaming,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
video = video,
thumbnail = thumbnail ?.fileId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
supportStreaming = supportStreaming,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (videoAsFile == null && thumbAsFile == null) {
@@ -139,6 +147,8 @@ data class SendVideoData internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(durationField)
@@ -157,6 +167,8 @@ data class SendVideoData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -168,6 +180,7 @@ data class SendVideoData internal constructor(
ThumbedSendMessageRequest<ContentMessage<VideoContent>>,
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
SizedSendMessageRequest<ContentMessage<VideoContent>>,
WithCustomizableCaptionRequest<ContentMessage<VideoContent>>,
OptionallyWithSpoilerRequest
{
override val textSources: TextSourcesList? by lazy {

View File

@@ -23,6 +23,7 @@ fun SendVideoNote(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoNoteContent>> {
@@ -30,17 +31,18 @@ fun SendVideoNote(
val thumbAsFile = thumbnail as? MultipartFile
val data = SendVideoNoteData(
chatId,
videoNote,
thumbnail ?.fileId,
duration,
size,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
videoNote = videoNote,
thumbnail = thumbnail ?.fileId,
duration = duration,
width = size,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (videoNoteAsFile == null && thumbAsFile == null) {
@@ -76,6 +78,8 @@ data class SendVideoNoteData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -31,24 +31,26 @@ fun SendVoice(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> {
val voiceAsFile = voice as? MultipartFile
val data = SendVoiceData(
chatId,
voice,
text,
parseMode,
null,
duration,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
voice = voice,
text = text,
parseMode = parseMode,
rawEntities = null,
duration = duration,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (voiceAsFile == null) {
@@ -70,24 +72,26 @@ fun SendVoice(
duration: Long? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> {
val voiceAsFile = voice as? MultipartFile
val data = SendVoiceData(
chatId,
voice,
entities.makeString(),
null,
entities.toRawMessageEntities(),
duration,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
voice = voice,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
duration = duration,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
return if (voiceAsFile == null) {
@@ -125,6 +129,8 @@ data class SendVoiceData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)

View File

@@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.message.content.InvoiceContent
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.LabeledPricesSerializer
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@@ -26,7 +27,7 @@ data class CreateInvoiceLink(
@SerialName(payloadField)
override val payload: String,
@SerialName(providerTokenField)
override val providerToken: String,
override val providerToken: String?,
@SerialName(currencyField)
override val currency: Currency,
@Serializable(LabeledPricesSerializer::class)
@@ -73,6 +74,40 @@ data class CreateInvoiceLink(
override var photoHeight: Int? = null
private set
constructor(
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false
) : this(
title = title,
description = description,
payload = payload,
providerToken = null,
currency = Currency.XTR,
prices = prices,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts,
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress
)
init {
suggestedTipAmounts ?.let { _ ->
require(suggestedTipAmounts.size in suggestedTipAmountsLimit)

View File

@@ -0,0 +1,21 @@
package dev.inmo.tgbotapi.requests.send.payments
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.payments.abstracts.TelegramPaymentChargeId
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class RefundStarPayment(
@SerialName(userIdField)
val userId: UserId,
@SerialName(telegramPaymentChargeIdField)
val telegramPaymentChargeId: TelegramPaymentChargeId
) : SimpleRequest<Boolean> {
override fun method(): String = "refundStarPayment"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send.payments
import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData
import dev.inmo.tgbotapi.abstracts.types.*
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyWithEffectRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
@@ -12,6 +13,7 @@ import dev.inmo.tgbotapi.types.message.content.InvoiceContent
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.LabeledPricesSerializer
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
import kotlinx.serialization.*
private val invoiceMessageSerializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
@@ -31,7 +33,7 @@ data class SendInvoice(
@SerialName(payloadField)
override val payload: String,
@SerialName(providerTokenField)
override val providerToken: String,
override val providerToken: String?,
@SerialName(currencyField)
override val currency: Currency,
@Serializable(LabeledPricesSerializer::class)
@@ -65,6 +67,8 @@ data class SendInvoice(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -74,7 +78,8 @@ data class SendInvoice(
DisableNotification,
WithReplyParameters,
WithReplyMarkup,
SendMessageRequest<ContentMessage<InvoiceContent>> {
SendMessageRequest<ContentMessage<InvoiceContent>>,
OptionallyWithEffectRequest<ContentMessage<InvoiceContent>> {
override fun method(): String = "sendInvoice"
override val resultDeserializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
get() = invoiceMessageSerializer
@@ -95,6 +100,54 @@ data class SendInvoice(
override var photoHeight: Int? = null
private set
constructor(
chatId: IdChatIdentifier,
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) : this(
chatId = chatId,
title = title,
description = description,
payload = payload,
providerToken = null,
currency = Currency.XTR,
prices = prices,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts,
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
init {
suggestedTipAmounts ?.let { _ ->
require(suggestedTipAmounts.size in suggestedTipAmountsLimit)

View File

@@ -105,6 +105,7 @@ fun Poll.createRequest(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = when (this) {
@@ -120,6 +121,7 @@ fun Poll.createRequest(
businessConnectionId,
disableNotification,
protectContent,
effectId = effectId,
replyParameters,
replyMarkup
)
@@ -137,6 +139,7 @@ fun Poll.createRequest(
businessConnectionId,
disableNotification,
protectContent,
effectId = effectId,
replyParameters,
replyMarkup
)
@@ -152,6 +155,7 @@ fun Poll.createRequest(
businessConnectionId,
disableNotification,
protectContent,
effectId = effectId,
replyParameters,
replyMarkup
)
@@ -167,6 +171,7 @@ fun Poll.createRequest(
businessConnectionId,
disableNotification,
protectContent,
effectId = effectId,
replyParameters,
replyMarkup
)

View File

@@ -54,6 +54,8 @@ class SendQuizPoll internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -84,6 +86,7 @@ class SendQuizPoll internal constructor(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) : this(
@@ -104,6 +107,7 @@ class SendQuizPoll internal constructor(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -123,6 +127,7 @@ class SendQuizPoll internal constructor(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) : this(
@@ -143,6 +148,7 @@ class SendQuizPoll internal constructor(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -162,6 +168,7 @@ class SendQuizPoll internal constructor(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) : this(
@@ -182,6 +189,7 @@ class SendQuizPoll internal constructor(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -200,6 +208,7 @@ class SendQuizPoll internal constructor(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) : this(
@@ -220,6 +229,7 @@ class SendQuizPoll internal constructor(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -254,6 +264,7 @@ fun SendQuizPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
@@ -272,6 +283,7 @@ fun SendQuizPoll(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -290,6 +302,7 @@ fun SendQuizPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
@@ -307,6 +320,7 @@ fun SendQuizPoll(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -325,6 +339,7 @@ fun SendQuizPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
@@ -342,6 +357,7 @@ fun SendQuizPoll(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -359,6 +375,7 @@ fun SendQuizPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
@@ -375,6 +392,7 @@ fun SendQuizPoll(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -49,6 +49,8 @@ class SendRegularPoll private constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
@@ -70,6 +72,7 @@ class SendRegularPoll private constructor(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) : this(
@@ -87,6 +90,7 @@ class SendRegularPoll private constructor(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -105,6 +109,7 @@ class SendRegularPoll private constructor(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) : this(
@@ -122,6 +127,7 @@ class SendRegularPoll private constructor(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -149,24 +155,26 @@ fun SendRegularPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendRegularPoll(
chatId,
question,
options,
questionParseMode,
isAnonymous,
isClosed,
allowMultipleAnswers,
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
questionParseMode = questionParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
openPeriod = (closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
closeDate = (closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
fun SendRegularPoll(
@@ -181,23 +189,25 @@ fun SendRegularPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendRegularPoll(
chatId,
questionTextSources,
options,
isAnonymous,
isClosed,
allowMultipleAnswers,
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
questionEntities = questionTextSources,
options = options,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
openPeriod = (closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
closeDate = (closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
fun SendRegularPoll(
@@ -211,21 +221,23 @@ fun SendRegularPoll(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builder: EntitiesBuilderBody
) = SendRegularPoll(
chatId,
EntitiesBuilder().apply(builder).build(),
options,
closeInfo,
isAnonymous,
isClosed,
allowMultipleAnswers,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
questionTextSources = EntitiesBuilder().apply(builder).build(),
options = options,
closeInfo = closeInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -123,6 +123,7 @@ const val disableWebPagePreviewField = "disable_web_page_preview"
const val linkPreviewOptionsField = "link_preview_options"
const val disableNotificationField = "disable_notification"
const val protectContentField = "protect_content"
const val messageEffectIdField = "message_effect_id"
const val removeCaptionField = "remove_caption"
const val replyToMessageIdField = "reply_to_message_id"
const val replyParametersField = "reply_parameters"
@@ -227,6 +228,7 @@ const val canEditStoriesField = "can_edit_stories"
const val canDeleteStoriesField = "can_delete_stories"
const val captionEntitiesField = "caption_entities"
const val hasSpoilerField = "has_spoiler"
const val showCaptionAboveMediaField = "show_caption_above_media"
const val loginUrlField = "login_url"
const val forwardTextField = "forward_text"
const val botUsernameField = "bot_username"

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class EffectId(val string: String)

View File

@@ -22,26 +22,39 @@ fun InlineQueryResultGifCachedImpl(
title: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultGifCachedImpl(
id = id,
fileId = fileId,
title = title,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultGifCachedImpl(
id: InlineQueryId,
fileId: FileId,
title: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifCachedImpl(
id,
fileId,
title,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
fileId = fileId,
title = title,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -58,6 +71,8 @@ data class InlineQueryResultGifCachedImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -28,9 +28,25 @@ fun InlineQueryResultGifImpl(
title: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultGifImpl(
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
thumbnailMimeType = thumbnailMimeType,
width = width,
height = height,
duration = duration,
title = title,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultGifImpl(
id: InlineQueryId,
@@ -42,22 +58,24 @@ fun InlineQueryResultGifImpl(
duration: Int? = null,
title: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(
id,
url,
thumbnailUrl,
thumbnailMimeType,
width,
height,
duration,
title,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
thumbnailMimeType = thumbnailMimeType,
width = width,
height = height,
duration = duration,
title = title,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultGifImpl(
@@ -71,9 +89,24 @@ fun InlineQueryResultGifImpl(
title: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
) = InlineQueryResultGifImpl(
id = id,
url = gifFile.fileId,
thumbnailUrl = thumbnailUrl,
thumbnailMimeType = thumbnailMimeType,
width = width,
height = height,
duration = duration,
title = title,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultGifImpl(
id: InlineQueryId,
@@ -85,10 +118,22 @@ fun InlineQueryResultGifImpl(
duration: Int? = null,
title: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(
id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, entities, replyMarkup, inputMessageContent
id = id,
url = gifFile.fileId,
thumbnailUrl = thumbnailUrl,
thumbnailMimeType = thumbnailMimeType,
width = width,
height = height,
duration = duration,
title = title,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -115,6 +160,8 @@ data class InlineQueryResultGifImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -22,26 +22,39 @@ fun InlineQueryResultMpeg4GifCachedImpl(
title: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultMpeg4GifCachedImpl(
id = id,
fileId = fileId,
title = title,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultMpeg4GifCachedImpl(
id: InlineQueryId,
fileId: FileId,
title: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultMpeg4GifCachedImpl(
id,
fileId,
title,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
fileId = fileId,
title = title,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -58,6 +71,8 @@ data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -27,9 +27,25 @@ fun InlineQueryResultMpeg4GifImpl(
title: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultMpeg4GifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultMpeg4GifImpl(
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
thumbnailMimeType = thumbnailMimeType,
width = width,
height = height,
duration = duration,
title = title,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultMpeg4GifImpl(
id: InlineQueryId,
@@ -41,22 +57,24 @@ fun InlineQueryResultMpeg4GifImpl(
duration: Int? = null,
title: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultMpeg4GifImpl(
id,
url,
thumbnailUrl,
thumbnailMimeType,
width,
height,
duration,
title,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
thumbnailMimeType = thumbnailMimeType,
width = width,
height = height,
duration = duration,
title = title,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -83,6 +101,8 @@ data class InlineQueryResultMpeg4GifImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -23,9 +23,21 @@ fun InlineQueryResultPhotoCachedImpl(
description: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultPhotoCachedImpl(
id = id,
fileId = fileId,
title = title,
description = description,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultPhotoCachedImpl(
id: InlineQueryId,
@@ -33,18 +45,20 @@ fun InlineQueryResultPhotoCachedImpl(
title: String? = null,
description: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultPhotoCachedImpl(
id,
fileId,
title,
description,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
fileId = fileId,
title = title,
description = description,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -63,6 +77,8 @@ data class InlineQueryResultPhotoCachedImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -25,9 +25,24 @@ fun InlineQueryResultPhotoImpl(
description: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultPhotoImpl(id, url, thumbnailUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultPhotoImpl(
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
width = width,
height = height,
title = title,
description = description,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultPhotoImpl(
id: InlineQueryId,
@@ -38,21 +53,23 @@ fun InlineQueryResultPhotoImpl(
title: String? = null,
description: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultPhotoImpl(
id,
url,
thumbnailUrl,
width,
height,
title,
description,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
width = width,
height = height,
title = title,
description = description,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -77,6 +94,8 @@ data class InlineQueryResultPhotoImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -23,9 +23,21 @@ fun InlineQueryResultVideoCachedImpl(
description: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultVideoCachedImpl(
id = id,
fileId = fileId,
title = title,
description = description,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultVideoCachedImpl(
id: InlineQueryId,
@@ -33,18 +45,20 @@ fun InlineQueryResultVideoCachedImpl(
title: String,
description: String? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultVideoCachedImpl(
id,
fileId,
title,
description,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
fileId = fileId,
title = title,
description = description,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -63,6 +77,8 @@ data class InlineQueryResultVideoCachedImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -28,9 +28,26 @@ fun InlineQueryResultVideoImpl(
description: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultVideoImpl(id, url, thumbnailUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultVideoImpl(
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
mimeType = mimeType,
title = title,
width = width,
height = height,
duration = duration,
description = description,
text = text,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
fun InlineQueryResultVideoImpl(
id: InlineQueryId,
@@ -43,23 +60,25 @@ fun InlineQueryResultVideoImpl(
duration: Int? = null,
description: String? = null,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultVideoImpl(
id,
url,
thumbnailUrl,
mimeType,
title,
width,
height,
duration,
description,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup,
inputMessageContent
id = id,
url = url,
thumbnailUrl = thumbnailUrl,
mimeType = mimeType,
title = title,
width = width,
height = height,
duration = duration,
description = description,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup,
inputMessageContent = inputMessageContent
)
@Serializable
@@ -88,6 +107,8 @@ data class InlineQueryResultVideoImpl internal constructor(
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
interface WithCustomizableCaptionInlineQueryResult : InlineQueryResult, WithCustomizableCaption

View File

@@ -8,4 +8,5 @@ const val inlineQueryResultGifType = "gif"
interface InlineQueryResultGifCommon : InlineQueryResult,
OptionallyTitledInlineQueryResult,
TextedOutput,
WithInputMessageContentInlineQueryResult
WithInputMessageContentInlineQueryResult,
WithCustomizableCaptionInlineQueryResult

View File

@@ -8,4 +8,5 @@ const val inlineQueryResultMpeg4GifType = "mpeg4_gif"
interface InlineQueryResultMpeg4GifCommon : InlineQueryResult,
OptionallyTitledInlineQueryResult,
TextedOutput,
WithInputMessageContentInlineQueryResult
WithInputMessageContentInlineQueryResult,
WithCustomizableCaptionInlineQueryResult

View File

@@ -9,4 +9,5 @@ interface InlineQueryResultPhotoCommon : InlineQueryResult,
OptionallyTitledInlineQueryResult,
DescribedInlineQueryResult,
TextedOutput,
WithInputMessageContentInlineQueryResult
WithInputMessageContentInlineQueryResult,
WithCustomizableCaptionInlineQueryResult

View File

@@ -9,4 +9,5 @@ interface InlineQueryResultVideoCommon : InlineQueryResult,
TitledInlineQueryResult,
DescribedInlineQueryResult,
TextedOutput,
WithInputMessageContentInlineQueryResult
WithInputMessageContentInlineQueryResult,
WithCustomizableCaptionInlineQueryResult

View File

@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.LabeledPricesSerializer
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@@ -17,7 +18,7 @@ class InputInvoiceMessageContent(
@SerialName(payloadField)
override val payload: String,
@SerialName(providerTokenField)
override val providerToken: String,
override val providerToken: String?,
@SerialName(currencyField)
override val currency: Currency,
@Serializable(LabeledPricesSerializer::class)
@@ -58,6 +59,40 @@ class InputInvoiceMessageContent(
override var photoHeight: Int? = null
private set
constructor(
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false
) : this(
title = title,
description = description,
payload = payload,
providerToken = null,
currency = Currency.XTR,
prices = prices,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts,
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress
)
override fun setPhoto(
photoUrl: String,
photoSize: Long?,

View File

@@ -36,28 +36,32 @@ data class VideoFile(
inline fun VideoFile.toTelegramMediaVideo(
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
) = TelegramMediaVideo(
fileId,
text,
parseMode,
spoilered,
width,
height,
duration,
thumbnail ?.fileId
file = fileId,
text = text,
parseMode = parseMode,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
width = width,
height = height,
duration = duration,
thumb = thumbnail ?.fileId
)
@Suppress("NOTHING_TO_INLINE")
inline fun VideoFile.toTelegramMediaVideo(
textSources: TextSourcesList,
spoilered: Boolean = false
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
) = TelegramMediaVideo(
fileId,
textSources,
spoilered,
width,
height,
duration,
thumbnail ?.fileId
file = fileId,
entities = textSources,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
width = width,
height = height,
duration = duration,
thumb = thumbnail ?.fileId
)

View File

@@ -20,4 +20,4 @@ sealed interface AudioMediaGroupMemberTelegramMedia: MediaGroupMemberTelegramMed
sealed interface DocumentMediaGroupMemberTelegramMedia: MediaGroupMemberTelegramMedia
@Serializable(MediaGroupMemberTelegramMediaSerializer::class)
sealed interface VisualMediaGroupMemberTelegramMedia : MediaGroupMemberTelegramMedia, SpoilerableTelegramMedia
sealed interface VisualMediaGroupMemberTelegramMedia : MediaGroupMemberTelegramMedia, SpoilerableTelegramMedia, WithCustomizableCaptionTelegramMedia

View File

@@ -19,16 +19,18 @@ fun TelegramMediaAnimation(
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false,
width: Int? = null,
height: Int? = null,
duration: Long? = null,
thumb: InputFile? = null
) = TelegramMediaAnimation(file, text, parseMode, null, spoilered, width, height, duration, thumb)
) = TelegramMediaAnimation(file, text, parseMode, null, spoilered, showCaptionAboveMedia, width, height, duration, thumb)
fun TelegramMediaAnimation(
file: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false,
width: Int? = null,
height: Int? = null,
duration: Long? = null,
@@ -39,6 +41,7 @@ fun TelegramMediaAnimation(
null,
entities.toRawMessageEntities(),
spoilered,
showCaptionAboveMedia,
width,
height,
duration,
@@ -56,11 +59,13 @@ data class TelegramMediaAnimation internal constructor(
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
override val width: Int? = null,
override val height: Int? = null,
override val duration: Long? = null,
override val thumb: InputFile? = null
) : TelegramMedia, SizedTelegramMedia, DuratedTelegramMedia, ThumbedTelegramMedia, TextedOutput, SpoilerableTelegramMedia {
) : TelegramMedia, SizedTelegramMedia, DuratedTelegramMedia, ThumbedTelegramMedia, TextedOutput, SpoilerableTelegramMedia, WithCustomizableCaptionTelegramMedia {
override val type: String = "animation"
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)

View File

@@ -19,14 +19,16 @@ fun TelegramMediaPhoto(
file: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false
) = TelegramMediaPhoto(file, text, parseMode, null, spoilered)
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
) = TelegramMediaPhoto(file, text, parseMode, null, spoilered, showCaptionAboveMedia)
fun TelegramMediaPhoto(
file: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false
) = TelegramMediaPhoto(file, entities.makeString(), null, entities.toRawMessageEntities(), spoilered)
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
) = TelegramMediaPhoto(file, entities.makeString(), null, entities.toRawMessageEntities(), spoilered, showCaptionAboveMedia)
@Serializable
data class TelegramMediaPhoto internal constructor(
@@ -39,6 +41,8 @@ data class TelegramMediaPhoto internal constructor(
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
) : TelegramMedia, VisualMediaGroupMemberTelegramMedia {
override val type: String = photoTelegramMediaType
override val textSources: TextSourcesList? by lazy {
@@ -55,19 +59,23 @@ data class TelegramMediaPhoto internal constructor(
fun PhotoSize.toTelegramMediaPhoto(
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
): TelegramMediaPhoto = TelegramMediaPhoto(
fileId,
text,
parseMode,
spoilered
file = fileId,
text = text,
parseMode = parseMode,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia
)
fun PhotoSize.toTelegramMediaPhoto(
textSources: TextSourcesList = emptyList(),
spoilered: Boolean = false
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
): TelegramMediaPhoto = TelegramMediaPhoto(
fileId,
textSources,
spoilered
file = fileId,
entities = textSources,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia
)

View File

@@ -19,21 +19,45 @@ fun TelegramMediaVideo(
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false,
width: Int? = null,
height: Int? = null,
duration: Long? = null,
thumb: InputFile? = null
) = TelegramMediaVideo(file, text, parseMode, null, spoilered, width, height, duration, thumb)
) = TelegramMediaVideo(
file = file,
text = text,
parseMode = parseMode,
rawEntities = null,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
width = width,
height = height,
duration = duration,
thumb = thumb
)
fun TelegramMediaVideo(
file: InputFile,
entities: TextSourcesList,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false,
width: Int? = null,
height: Int? = null,
duration: Long? = null,
thumb: InputFile? = null
) = TelegramMediaVideo(file, entities.makeString(), null, entities.toRawMessageEntities(), spoilered, width, height, duration, thumb)
) = TelegramMediaVideo(
file = file,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
width = width,
height = height,
duration = duration,
thumb = thumb
)
@Serializable
data class TelegramMediaVideo internal constructor (
@@ -46,6 +70,8 @@ data class TelegramMediaVideo internal constructor (
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(hasSpoilerField)
override val spoilered: Boolean = false,
@SerialName(showCaptionAboveMediaField)
override val showCaptionAboveMedia: Boolean = false,
override val width: Int? = null,
override val height: Int? = null,
override val duration: Long? = null,

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.types.media
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
sealed interface WithCustomizableCaptionTelegramMedia : TelegramMedia, WithCustomizableCaption

View File

@@ -24,6 +24,7 @@ data class PrivateContentMessageImpl<T: MessageContent>(
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
override val effectId: EffectId?
) : PrivateContentMessage<T> {
constructor(
messageId: MessageId,
@@ -39,7 +40,8 @@ data class PrivateContentMessageImpl<T: MessageContent>(
senderBot: CommonBot?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
effectId: EffectId,
) : this(
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId, fromOffline
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId, fromOffline, effectId
)
}

View File

@@ -143,6 +143,10 @@ internal data class RawMessage(
private val link_preview_options: LinkPreviewOptions? = null,
private val effect_id: EffectId? = null,
private val show_caption_above_media: Boolean = false,
private val reply_markup: InlineKeyboardMarkup? = null,
// Business
@@ -176,7 +180,8 @@ internal data class RawMessage(
caption,
adaptedCaptionEntities,
has_media_spoiler ?: false,
quote
quote,
show_caption_above_media
)
animation != null -> AnimationContent(
animation,
@@ -184,7 +189,8 @@ internal data class RawMessage(
caption,
adaptedCaptionEntities,
has_media_spoiler ?: false,
quote
quote,
show_caption_above_media
)
document != null -> DocumentContent(
document,
@@ -203,7 +209,8 @@ internal data class RawMessage(
caption,
adaptedCaptionEntities,
has_media_spoiler ?: false,
quote
quote,
show_caption_above_media
)
sticker != null -> StickerContent(sticker)
dice != null -> DiceContent(dice)
@@ -546,7 +553,8 @@ internal data class RawMessage(
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
fromOffline = is_from_offline,
effectId = effect_id
)
} else {
BusinessContentMessageImpl(

View File

@@ -32,6 +32,7 @@ internal data class RawMessageEntity(
"phone_number" -> 1
"bold" -> 1
"blockquote" -> 0
"expandable_blockquote" -> 0
"italic" -> 1
"text_mention" -> 1
"strikethrough" -> 1
@@ -66,6 +67,7 @@ internal fun RawMessageEntity.asTextSource(
"phone_number" -> PhoneNumberTextSource(sourceSubstring, subPartsWithRegulars)
"bold" -> BoldTextSource(sourceSubstring, subPartsWithRegulars)
"blockquote" -> BlockquoteTextSource(sourceSubstring, subPartsWithRegulars)
"expandable_blockquote" -> ExpandableBlockquoteTextSource(sourceSubstring, subPartsWithRegulars)
"italic" -> ItalicTextSource(sourceSubstring, subPartsWithRegulars)
"code" -> CodeTextSource(sourceSubstring)
"pre" -> PreTextSource(sourceSubstring, language)
@@ -186,6 +188,7 @@ internal fun TextSource.toRawMessageEntities(offset: Int = 0): List<RawMessageEn
is PhoneNumberTextSource -> RawMessageEntity("phone_number", offset, length)
is BoldTextSource -> RawMessageEntity("bold", offset, length)
is BlockquoteTextSource -> RawMessageEntity("blockquote", offset, length)
is ExpandableBlockquoteTextSource -> RawMessageEntity("expandable_blockquote", offset, length)
is ItalicTextSource -> RawMessageEntity("italic", offset, length)
is CodeTextSource -> RawMessageEntity("code", offset, length)
is PreTextSource -> RawMessageEntity("pre", offset, length, language = language)

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.abstracts.types.OptionallyWithEffectId
interface PossiblyWithEffectMessage : Message, OptionallyWithEffectId

View File

@@ -3,6 +3,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage, PossiblyOfflineMessage {
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage, PossiblyOfflineMessage, PossiblyWithEffectMessage {
override val chat: PreviewPrivateChat
}

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.abstracts.SpoilerableData
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.*
@@ -142,6 +143,7 @@ sealed interface MediaContent: MessageContent {
}
sealed interface SpoilerableMediaContent : MediaContent, SpoilerableData
sealed interface WithCustomizedCaptionMediaContent : MediaContent, TextedContent, WithCustomizableCaption
@ClassCastsIncluded
sealed interface ResendableContent {
@@ -151,6 +153,7 @@ sealed interface ResendableContent {
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId?,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<out AccessibleMessage>
@@ -161,6 +164,7 @@ sealed interface ResendableContent {
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId?,
replyToMessageId: MessageId?,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -170,6 +174,7 @@ sealed interface ResendableContent {
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyToMessageId ?.let {
ReplyParameters(
chatId,

View File

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

View File

@@ -19,40 +19,45 @@ data class AnimationContent(
override val text: String?,
override val textSources: TextSourcesList = emptyList(),
override val spoilered: Boolean = false,
override val quote: TextQuote? = null
) : TextedMediaContent, SpoilerableMediaContent {
override val quote: TextQuote? = null,
override val showCaptionAboveMedia: Boolean = false
) : TextedMediaContent, SpoilerableMediaContent, WithCustomizedCaptionMediaContent {
override fun createResend(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId?,
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<AnimationContent>> = SendAnimation(
chatId,
media.fileId,
media.thumbnail ?.fileId,
textSources,
spoilered,
media.duration,
media.width,
media.height,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
animation = media.fileId,
thumbnail = media.thumbnail ?.fileId,
entities = textSources,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = media.duration,
width = media.width,
height = media.height,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun asTelegramMedia(): TelegramMediaAnimation = TelegramMediaAnimation(
media.fileId,
textSources,
spoilered,
media.width,
media.height,
media.duration,
media.thumbnail ?.fileId
file = media.fileId,
entities = textSources,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
width = media.width,
height = media.height,
duration = media.duration,
thumb = media.thumbnail ?.fileId
)
}

View File

@@ -25,22 +25,24 @@ data class AudioContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<AudioContent>> = SendAudio(
chatId,
media.fileId,
media.thumbnail ?.fileId,
textSources,
media.duration,
media.performer,
media.title,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
audio = media.fileId,
thumbnail = media.thumbnail ?.fileId,
entities = textSources,
duration = media.duration,
performer = media.performer,
title = media.title,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun toMediaGroupMemberTelegramMedia(): TelegramMediaAudio = asTelegramMedia()

View File

@@ -18,9 +18,18 @@ data class ContactContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<ContactContent>> = SendContact(
chatId, contact, messageThreadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup
chatId = chatId,
contact = contact,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
}

View File

@@ -2,10 +2,7 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendDice
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.dice.Dice
@@ -22,16 +19,18 @@ data class DiceContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<DiceContent>> = SendDice(
chatId,
dice.animationType,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
animationType = dice.animationType,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
}

View File

@@ -28,19 +28,21 @@ data class DocumentContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<DocumentContent>> = SendDocument(
chatId,
media.fileId,
media.thumbnail ?.fileId,
textSources,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
document = media.fileId,
thumbnail = media.thumbnail ?.fileId,
entities = textSources,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun toMediaGroupMemberTelegramMedia(): TelegramMediaDocument = asTelegramMedia()

View File

@@ -2,10 +2,7 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.games.SendGame
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.games.Game
@@ -22,16 +19,18 @@ data class GameContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<GameContent>> = SendGame(
chatId,
game.title,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
gameShortName = game.title,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
}

View File

@@ -22,6 +22,7 @@ data class GiveawayContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<out AccessibleMessage> {

View File

@@ -19,6 +19,7 @@ data class GiveawayPublicResultsContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<out AccessibleMessage> {

View File

@@ -1,10 +1,7 @@
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
@@ -21,6 +18,7 @@ data class InvoiceContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<InvoiceContent>> {

View File

@@ -4,10 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
import dev.inmo.tgbotapi.requests.send.SendStaticLocation
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.location.*
@@ -104,22 +101,24 @@ data class LiveLocationContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<LiveLocationContent>> = SendLiveLocation(
chatId,
location.latitude,
location.longitude,
location.livePeriod,
location.horizontalAccuracy,
location.heading,
location.proximityAlertRadius,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = location.livePeriod,
horizontalAccuracy = location.horizontalAccuracy,
heading = location.heading,
proximityAlertRadius = location.proximityAlertRadius,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) as SendMessageRequest<ContentMessage<LiveLocationContent>>
}
@@ -137,17 +136,19 @@ data class StaticLocationContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<StaticLocationContent>> = SendStaticLocation(
chatId,
location.latitude,
location.longitude,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) as SendMessageRequest<ContentMessage<StaticLocationContent>>
}

View File

@@ -37,15 +37,17 @@ data class MediaGroupContent<T : MediaGroupPartContent>(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<MediaGroupContent<MediaGroupPartContent>>> = SendMediaGroup<MediaGroupPartContent>(
chatId,
group.map { it.content.toMediaGroupMemberTelegramMedia() },
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
chatId = chatId,
media = group.map { it.content.toMediaGroupMemberTelegramMedia() },
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
)
}

View File

@@ -19,7 +19,8 @@ data class PhotoContent(
override val text: String? = null,
override val textSources: TextSourcesList = emptyList(),
override val spoilered: Boolean = false,
override val quote: TextQuote? = null
override val quote: TextQuote? = null,
override val showCaptionAboveMedia: Boolean = false
) : MediaCollectionContent<PhotoSize>, VisualMediaGroupPartContent, WithOptionalQuoteInfo {
override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content")
@@ -29,22 +30,25 @@ data class PhotoContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<PhotoContent>> = SendPhoto(
chatId,
media.fileId,
textSources,
spoilered,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
photo = media.fileId,
entities = textSources,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun toMediaGroupMemberTelegramMedia(): TelegramMediaPhoto = asTelegramMedia()
override fun asTelegramMedia(): TelegramMediaPhoto = media.toTelegramMediaPhoto(textSources, spoilered)
override fun asTelegramMedia(): TelegramMediaPhoto = media.toTelegramMediaPhoto(textSources, spoilered, showCaptionAboveMedia)
}

View File

@@ -2,10 +2,7 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.polls.createRequest
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
@@ -22,15 +19,17 @@ data class PollContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<PollContent>> = poll.createRequest(
chatId,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
}

View File

@@ -2,11 +2,8 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendSticker
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.Sticker
@@ -23,18 +20,19 @@ data class StickerContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<StickerContent>> = SendSticker(
chatId,
media.fileId,
messageThreadId,
businessConnectionId,
media.emoji,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
sticker = media.fileId,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun asTelegramMedia(): TelegramMediaDocument = TelegramMediaDocument(

View File

@@ -2,10 +2,7 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.ForwardMessage
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
@@ -25,6 +22,7 @@ data class StoryContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<PossiblyForwardedMessage> {

View File

@@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendTextMessage
import dev.inmo.tgbotapi.types.*
@@ -24,17 +23,19 @@ data class TextContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<TextContent>> = SendTextMessage(
chatId,
textSources,
linkPreviewOptions,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
entities = textSources,
linkPreviewOptions = linkPreviewOptions,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
}

View File

@@ -2,10 +2,7 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendVenue
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
@@ -22,9 +19,18 @@ data class VenueContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VenueContent>> = SendVenue(
chatId, venue, messageThreadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup
chatId = chatId,
venue = venue,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
}

View File

@@ -18,7 +18,8 @@ data class VideoContent(
override val text: String? = null,
override val textSources: TextSourcesList = emptyList(),
override val spoilered: Boolean = false,
override val quote: TextQuote? = null
override val quote: TextQuote? = null,
override val showCaptionAboveMedia: Boolean = false
) : VisualMediaGroupPartContent {
override fun createResend(
chatId: ChatIdentifier,
@@ -26,27 +27,34 @@ data class VideoContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VideoContent>> = SendVideo(
chatId,
media.fileId,
media.thumbnail ?.fileId,
textSources,
spoilered,
media.duration,
media.width,
media.height,
null,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
video = media.fileId,
thumbnail = media.thumbnail ?.fileId,
entities = textSources,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = media.duration,
width = media.width,
height = media.height,
supportStreaming = null,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun toMediaGroupMemberTelegramMedia(): TelegramMediaVideo = asTelegramMedia()
override fun asTelegramMedia(): TelegramMediaVideo = media.toTelegramMediaVideo(textSources)
override fun asTelegramMedia(): TelegramMediaVideo = media.toTelegramMediaVideo(
textSources = textSources,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia
)
}

View File

@@ -2,11 +2,8 @@ package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendVideoNote
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.VideoNoteFile
@@ -23,20 +20,22 @@ data class VideoNoteContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VideoNoteContent>> = SendVideoNote(
chatId,
media.fileId,
media.thumbnail ?.fileId,
media.duration,
media.width,
messageThreadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
chatId = chatId,
videoNote = media.fileId,
thumbnail = media.thumbnail ?.fileId,
duration = media.duration,
size = media.width,
threadId = messageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
override fun asTelegramMedia(): TelegramMediaVideo = TelegramMediaVideo(

View File

@@ -5,7 +5,6 @@ import dev.inmo.tgbotapi.requests.send.media.SendVoice
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.abstracts.WithOptionalQuoteInfo
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.VoiceFile
@@ -25,6 +24,7 @@ data class VoiceContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VoiceContent>> = SendVoice(
@@ -36,6 +36,7 @@ data class VoiceContent(
duration = media.duration,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -0,0 +1,26 @@
package dev.inmo.tgbotapi.types.message.textsources
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.extensions.makeString
import dev.inmo.tgbotapi.utils.internal.*
import kotlinx.serialization.Serializable
/**
* @see expandableBlockquote
*/
@Serializable
data class ExpandableBlockquoteTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val subsources: TextSourcesList
) : MultilevelTextSource {
override val markdown: String by lazy { source.expandableBlockquoteMarkdown() }
override val markdownV2: String by lazy { expandableBlockquoteMarkdownV2() }
override val html: String by lazy { expandableBlockquoteHTML() }
}
@Suppress("NOTHING_TO_INLINE")
inline fun expandableBlockquote(parts: TextSourcesList) = ExpandableBlockquoteTextSource(parts.makeString(), parts)
@Suppress("NOTHING_TO_INLINE")
inline fun expandableBlockquote(vararg parts: TextSource) = expandableBlockquote(parts.toList())
@Suppress("NOTHING_TO_INLINE")
inline fun expandableBlockquote(text: String) = expandableBlockquote(regular(text))

View File

@@ -22,14 +22,37 @@ sealed interface TextSource {
get() = source
}
@Suppress("NOTHING_TO_INLINE")
inline operator fun TextSource.plus(other: TextSource) = listOf(this, other)
@Suppress("NOTHING_TO_INLINE")
inline operator fun TextSource.plus(other: List<TextSource>) = listOf(this) + other
@Suppress("NOTHING_TO_INLINE")
inline operator fun TextSource.plus(text: String) = listOf(this, regular(text))
@Suppress("NOTHING_TO_INLINE")
inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
operator fun TextSource.plus(other: TextSource) = when {
this is RegularTextSource && other is RegularTextSource -> listOf(RegularTextSource(source + other.source))
else -> listOf(this, other)
}
operator fun TextSource.plus(text: String) = this + regular(text)
operator fun List<TextSource>.plus(text: String): List<TextSource> {
val newList = mutableListOf<TextSource>()
for (i in 0 until size - 1) {
newList.add(get(i))
}
val sublist = lastOrNull() ?.let {
it + text
} ?: listOf(regular(text))
newList.addAll(sublist)
return newList
}
operator fun TextSource.plus(other: List<TextSource>) = other.fold(listOf(this)) { acc, textSource ->
val newList = mutableListOf<TextSource>()
for (i in 0 until acc.size - 1) {
newList.add(acc.get(i))
}
newList.addAll(acc.last() + textSource)
newList
}
@Serializable(TextSourceSerializer::class)
sealed interface MultilevelTextSource : TextSource {

View File

@@ -14,7 +14,7 @@ data class SuccessfulPayment(
@SerialName(invoicePayloadField)
val invoicePayload: String,
@SerialName(telegramPaymentChargeIdField)
val telegramPaymentChargeId: String,
val telegramPaymentChargeId: TelegramPaymentChargeId,
@SerialName(providerPaymentChargeIdField)
val providerPaymentChargeId: String,
@SerialName(shippingOptionIdField)

View File

@@ -2,6 +2,9 @@ package dev.inmo.tgbotapi.types.payments.abstracts
typealias Currency = String
val String.Companion.XTR
get() = "XTR"
interface Currencied {
val currency: Currency
}

View File

@@ -0,0 +1,10 @@
package dev.inmo.tgbotapi.types.payments.abstracts
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class TelegramPaymentChargeId(
val string: String
)

View File

@@ -140,6 +140,44 @@ inline fun EntitiesBuilder.blockquote(text: String) = add(dev.inmo.tgbotapi.type
*/
inline fun EntitiesBuilder.blockquoteln(text: String) = blockquote(text) + newLine
/**
* Add blockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.blockquote]
*/
inline fun EntitiesBuilder.expandableBlockquote(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(parts))
/**
* Version of [EntitiesBuilder.expandableBlockquote] with new line at the end
*/
inline fun EntitiesBuilder.expandableBlockquoteln(parts: TextSourcesList) = expandableBlockquote(parts) + newLine
/**
* Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote].
* Will reuse separator config from [buildEntities]
*/
inline fun EntitiesBuilder.expandableBlockquote(noinline init: EntitiesBuilderBody) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(
buildEntities(separator, init)
))
/**
* Version of [EntitiesBuilder.expandableBlockquote] with new line at the end.
* Will reuse separator config from [buildEntities]
*/
inline fun EntitiesBuilder.expandableBlockquoteln(noinline init: EntitiesBuilderBody) = expandableBlockquote(init) + newLine
/**
* Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote]
*/
inline fun EntitiesBuilder.expandableBlockquote(vararg parts: TextSource) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(*parts))
/**
* Version of [EntitiesBuilder.expandableBlockquote] with new line at the end
*/
inline fun EntitiesBuilder.expandableBlockquoteln(vararg parts: TextSource) = expandableBlockquote(*parts) + newLine
/**
* Add expandableBlockquote using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote]
*/
inline fun EntitiesBuilder.expandableBlockquote(text: String) = add(dev.inmo.tgbotapi.types.message.textsources.expandableBlockquote(text))
/**
* Version of [EntitiesBuilder.expandableBlockquote] with new line at the end
*/
inline fun EntitiesBuilder.expandableBlockquoteln(text: String) = expandableBlockquote(text) + newLine
/**
* Add spoiler using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.spoiler]
*/

View File

@@ -60,7 +60,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
sourceMessage.replyMarkup,
sourceMessage.senderBot,
sourceMessage.mediaGroupId,
sourceMessage.fromOffline
sourceMessage.fromOffline,
sourceMessage.effectId
)
is AnonymousGroupContentMessage -> AnonymousGroupContentMessageImpl(
sourceMessage.chat,

Some files were not shown because too many files have changed in this diff Show More