mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 23:29:33 +00:00
potentially cover new update of Bot API
This commit is contained in:
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.ForwardMessage
|
|||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.Seconds
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||||
@@ -15,10 +16,11 @@ public suspend fun TelegramBot.forwardMessage(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
): PossiblyForwardedMessage = execute(
|
): PossiblyForwardedMessage = execute(
|
||||||
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
|
ForwardMessage(fromChatId, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
@@ -26,40 +28,45 @@ public suspend fun TelegramBot.forwardMessage(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)
|
): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||||
|
@@ -21,6 +21,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -35,6 +36,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -55,6 +57,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -68,6 +71,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -87,6 +91,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -100,6 +105,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -119,6 +125,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -132,6 +139,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -151,6 +159,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -164,6 +173,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -183,6 +193,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -195,6 +206,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -213,6 +225,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -225,6 +238,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -243,6 +257,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -255,6 +270,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -273,6 +289,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -286,6 +303,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -304,6 +322,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -317,6 +336,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -334,6 +354,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -346,6 +367,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -363,6 +385,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -375,6 +398,7 @@ public suspend inline fun TelegramBot.copyMessage(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
|
@@ -25,6 +25,8 @@ public suspend fun TelegramBot.sendVideo(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
|
cover: InputFile? = null,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -45,6 +47,8 @@ public suspend fun TelegramBot.sendVideo(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = cover,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
@@ -87,6 +91,8 @@ public suspend fun TelegramBot.sendVideo(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = video.cover ?.fileId,
|
||||||
|
startTimestamp = video.startTimestamp,
|
||||||
duration = video.duration,
|
duration = video.duration,
|
||||||
width = video.width,
|
width = video.width,
|
||||||
height = video.height,
|
height = video.height,
|
||||||
@@ -112,6 +118,8 @@ public suspend fun TelegramBot.sendVideo(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
|
cover: InputFile? = null,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -131,6 +139,8 @@ public suspend fun TelegramBot.sendVideo(
|
|||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = cover,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
@@ -192,6 +202,8 @@ public suspend inline fun TelegramBot.sendVideo(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
|
cover: InputFile? = null,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -211,6 +223,8 @@ public suspend inline fun TelegramBot.sendVideo(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = cover,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
@@ -251,6 +265,8 @@ public suspend inline fun TelegramBot.sendVideo(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = video.cover ?.fileId,
|
||||||
|
startTimestamp = video.startTimestamp,
|
||||||
duration = video.duration,
|
duration = video.duration,
|
||||||
width = video.width,
|
width = video.width,
|
||||||
height = video.height,
|
height = video.height,
|
||||||
@@ -275,6 +291,8 @@ public suspend inline fun TelegramBot.sendVideo(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
|
cover: InputFile? = null,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -293,6 +311,8 @@ public suspend inline fun TelegramBot.sendVideo(
|
|||||||
entities = entities,
|
entities = entities,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = cover,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.inmo.tgbotapi.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.files.Photo
|
||||||
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
|
interface CoverableData {
|
||||||
|
val cover: Photo?
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.Seconds
|
||||||
|
|
||||||
|
interface WithCustomStartMediaData {
|
||||||
|
val startTimestamp: Seconds?
|
||||||
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.requests
|
package dev.inmo.tgbotapi.requests
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData
|
||||||
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
||||||
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
@@ -21,11 +22,13 @@ data class ForwardMessage(
|
|||||||
override val messageId: MessageId,
|
override val messageId: MessageId,
|
||||||
@SerialName(messageThreadIdField)
|
@SerialName(messageThreadIdField)
|
||||||
override val threadId: MessageThreadId? = toChatId.threadId,
|
override val threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
@SerialName(videoStartTimestampField)
|
||||||
|
override val startTimestamp: Seconds? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
val disableNotification: Boolean = false,
|
val disableNotification: Boolean = false,
|
||||||
@SerialName(protectContentField)
|
@SerialName(protectContentField)
|
||||||
override val protectContent: Boolean = false
|
override val protectContent: Boolean = false
|
||||||
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent, OptionallyMessageThreadRequest {
|
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent, OptionallyMessageThreadRequest, WithCustomStartMediaData {
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
get() = fromChatId
|
get() = fromChatId
|
||||||
|
|
||||||
|
@@ -5,4 +5,11 @@ import kotlinx.serialization.json.JsonObject
|
|||||||
interface MultipartRequest<T: Any> : Request<T> {
|
interface MultipartRequest<T: Any> : Request<T> {
|
||||||
val paramsJson: JsonObject
|
val paramsJson: JsonObject
|
||||||
val mediaMap: Map<String, MultipartFile>
|
val mediaMap: Map<String, MultipartFile>
|
||||||
|
|
||||||
|
interface Common<T : Any> : MultipartRequest<T>, SimpleRequest<T> {
|
||||||
|
val data: SimpleRequest<T>
|
||||||
|
|
||||||
|
override val paramsJson: JsonObject
|
||||||
|
get() = data.json()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.abstracts.TextedOutput
|
import dev.inmo.tgbotapi.abstracts.TextedOutput
|
||||||
|
import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData
|
||||||
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
|
import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption
|
||||||
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
||||||
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
||||||
@@ -89,6 +90,7 @@ fun CopyMessage(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -103,6 +105,7 @@ fun CopyMessage(
|
|||||||
rawEntities = null,
|
rawEntities = null,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -117,6 +120,7 @@ fun CopyMessage(
|
|||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
@@ -131,6 +135,7 @@ fun CopyMessage(
|
|||||||
rawEntities = entities.toRawMessageEntities(),
|
rawEntities = entities.toRawMessageEntities(),
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
@@ -156,6 +161,8 @@ data class CopyMessage internal constructor(
|
|||||||
override val showCaptionAboveMedia: Boolean = false,
|
override val showCaptionAboveMedia: Boolean = false,
|
||||||
@SerialName(messageThreadIdField)
|
@SerialName(messageThreadIdField)
|
||||||
override val threadId: MessageThreadId? = toChatId.threadId,
|
override val threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
@SerialName(videoStartTimestampField)
|
||||||
|
override val startTimestamp: Seconds? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
@SerialName(protectContentField)
|
@SerialName(protectContentField)
|
||||||
@@ -172,7 +179,8 @@ data class CopyMessage internal constructor(
|
|||||||
MessageAction,
|
MessageAction,
|
||||||
TextedOutput,
|
TextedOutput,
|
||||||
ProtectContent,
|
ProtectContent,
|
||||||
OptionallyMessageThreadRequest {
|
OptionallyMessageThreadRequest,
|
||||||
|
WithCustomStartMediaData {
|
||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
get() = fromChatId
|
get() = fromChatId
|
||||||
override val textSources: List<TextSource>? by lazy {
|
override val textSources: List<TextSource>? by lazy {
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.send.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
|
|
||||||
|
interface CoveredSendMessageRequest<T: Any>: SendMessageRequest<T> {
|
||||||
|
/**
|
||||||
|
* Duration of media, usually in seconds
|
||||||
|
*/
|
||||||
|
val cover: String?
|
||||||
|
}
|
@@ -51,6 +51,11 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
|
|||||||
it.thumb as? MultipartFile
|
it.thumb as? MultipartFile
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
},
|
||||||
|
if (it is CoveredTelegramMedia) {
|
||||||
|
it.cover as? MultipartFile
|
||||||
|
} else {
|
||||||
|
null
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@ import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
|||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.message.parseModeField
|
import dev.inmo.tgbotapi.types.message.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.media.CoveredTelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
|
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.message.*
|
import dev.inmo.tgbotapi.types.message.*
|
||||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||||
@@ -63,6 +64,11 @@ fun SendPaidMedia(
|
|||||||
it.thumb as? MultipartFile
|
it.thumb as? MultipartFile
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
},
|
||||||
|
if (it is CoveredTelegramMedia) {
|
||||||
|
it.cover as? MultipartFile
|
||||||
|
} else {
|
||||||
|
null
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -117,6 +123,11 @@ fun SendPaidMedia(
|
|||||||
it.thumb as? MultipartFile
|
it.thumb as? MultipartFile
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
},
|
||||||
|
if (it is CoveredTelegramMedia) {
|
||||||
|
it.cover as? MultipartFile
|
||||||
|
} else {
|
||||||
|
null
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
@@ -29,6 +30,8 @@ fun SendVideo(
|
|||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
|
cover: InputFile? = null,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -44,11 +47,14 @@ fun SendVideo(
|
|||||||
): Request<ContentMessage<VideoContent>> {
|
): Request<ContentMessage<VideoContent>> {
|
||||||
val videoAsFile = video as? MultipartFile
|
val videoAsFile = video as? MultipartFile
|
||||||
val thumbAsFile = thumbnail as? MultipartFile
|
val thumbAsFile = thumbnail as? MultipartFile
|
||||||
|
val coverAsFile = cover as? MultipartFile
|
||||||
|
|
||||||
val data = SendVideoData(
|
val data = SendVideoData(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
video = video,
|
video = video,
|
||||||
thumbnail = thumbnail ?.fileId,
|
thumbnail = thumbnail ?.fileId,
|
||||||
|
cover = cover ?.fileId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
text = text,
|
text = text,
|
||||||
parseMode = parseMode,
|
parseMode = parseMode,
|
||||||
rawEntities = null,
|
rawEntities = null,
|
||||||
@@ -68,12 +74,12 @@ fun SendVideo(
|
|||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
return if (videoAsFile == null && thumbAsFile == null) {
|
return if (videoAsFile == null && thumbAsFile == null && coverAsFile == null) {
|
||||||
data
|
data
|
||||||
} else {
|
} else {
|
||||||
CommonMultipartFileRequest(
|
CommonMultipartFileRequest(
|
||||||
data,
|
data,
|
||||||
listOfNotNull(videoAsFile, thumbAsFile).associateBy { it.fileId }
|
listOfNotNull(videoAsFile, thumbAsFile, coverAsFile).associateBy { it.fileId }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +91,8 @@ fun SendVideo(
|
|||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
showCaptionAboveMedia: Boolean = false,
|
showCaptionAboveMedia: Boolean = false,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
|
cover: InputFile? = null,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -100,11 +108,14 @@ fun SendVideo(
|
|||||||
): Request<ContentMessage<VideoContent>> {
|
): Request<ContentMessage<VideoContent>> {
|
||||||
val videoAsFile = video as? MultipartFile
|
val videoAsFile = video as? MultipartFile
|
||||||
val thumbAsFile = thumbnail as? MultipartFile
|
val thumbAsFile = thumbnail as? MultipartFile
|
||||||
|
val coverAsFile = cover as? MultipartFile
|
||||||
|
|
||||||
val data = SendVideoData(
|
val data = SendVideoData(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
video = video,
|
video = video,
|
||||||
thumbnail = thumbnail ?.fileId,
|
thumbnail = thumbnail ?.fileId,
|
||||||
|
cover = cover ?.fileId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
text = entities.makeString(),
|
text = entities.makeString(),
|
||||||
parseMode = null,
|
parseMode = null,
|
||||||
rawEntities = entities.toRawMessageEntities(),
|
rawEntities = entities.toRawMessageEntities(),
|
||||||
@@ -124,12 +135,12 @@ fun SendVideo(
|
|||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
return if (videoAsFile == null && thumbAsFile == null) {
|
return if (videoAsFile == null && thumbAsFile == null && coverAsFile == null) {
|
||||||
data
|
data
|
||||||
} else {
|
} else {
|
||||||
CommonMultipartFileRequest(
|
CommonMultipartFileRequest(
|
||||||
data,
|
data,
|
||||||
listOfNotNull(videoAsFile, thumbAsFile).associateBy { it.fileId }
|
listOfNotNull(videoAsFile, thumbAsFile, coverAsFile).associateBy { it.fileId }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,6 +156,10 @@ data class SendVideoData internal constructor(
|
|||||||
val video: InputFile,
|
val video: InputFile,
|
||||||
@SerialName(thumbnailField)
|
@SerialName(thumbnailField)
|
||||||
override val thumbnail: String? = null,
|
override val thumbnail: String? = null,
|
||||||
|
@SerialName(coverField)
|
||||||
|
override val cover: String? = null,
|
||||||
|
@SerialName(startTimestampField)
|
||||||
|
override val startTimestamp: Seconds? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
@@ -187,6 +202,8 @@ data class SendVideoData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
|
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
|
||||||
SizedSendMessageRequest<ContentMessage<VideoContent>>,
|
SizedSendMessageRequest<ContentMessage<VideoContent>>,
|
||||||
WithCustomizableCaptionRequest<ContentMessage<VideoContent>>,
|
WithCustomizableCaptionRequest<ContentMessage<VideoContent>>,
|
||||||
|
CoveredSendMessageRequest<ContentMessage<VideoContent>>,
|
||||||
|
WithCustomStartMediaData,
|
||||||
OptionallyWithSpoilerRequest
|
OptionallyWithSpoilerRequest
|
||||||
{
|
{
|
||||||
override val textSources: TextSourcesList? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
|
@@ -315,6 +315,9 @@ const val userAdministratorRightsField = "user_administrator_rights"
|
|||||||
const val botAdministratorRightsField = "bot_administrator_rights"
|
const val botAdministratorRightsField = "bot_administrator_rights"
|
||||||
const val botIsMemberField = "bot_is_member"
|
const val botIsMemberField = "bot_is_member"
|
||||||
|
|
||||||
|
const val startTimestampField = "start_timestamp"
|
||||||
|
const val videoStartTimestampField = "video_start_timestamp"
|
||||||
|
|
||||||
const val fileNameField = "file_name"
|
const val fileNameField = "file_name"
|
||||||
const val mimeTypeField = "mime_type"
|
const val mimeTypeField = "mime_type"
|
||||||
const val fileIdField = "file_id"
|
const val fileIdField = "file_id"
|
||||||
@@ -424,6 +427,7 @@ const val idField = "id"
|
|||||||
const val pollIdField = "poll_id"
|
const val pollIdField = "poll_id"
|
||||||
const val textField = "text"
|
const val textField = "text"
|
||||||
const val thumbnailField = "thumbnail"
|
const val thumbnailField = "thumbnail"
|
||||||
|
const val coverField = "cover"
|
||||||
const val emojiField = "emoji"
|
const val emojiField = "emoji"
|
||||||
const val emojisField = "emojis"
|
const val emojisField = "emojis"
|
||||||
const val titleField = "title"
|
const val titleField = "title"
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.CoverableData
|
||||||
|
|
||||||
|
sealed interface CoveredMediaFile : TelegramMediaFile, CoverableData
|
@@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData
|
||||||
|
|
||||||
|
sealed interface CustomStartMediaFile : WithCustomStartMediaData
|
@@ -24,13 +24,17 @@ data class VideoFile(
|
|||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(thumbnailField)
|
@SerialName(thumbnailField)
|
||||||
override val thumbnail: PhotoSize? = null,
|
override val thumbnail: PhotoSize? = null,
|
||||||
|
@SerialName(coverField)
|
||||||
|
override val cover: Photo? = null,
|
||||||
|
@SerialName(startTimestampField)
|
||||||
|
override val startTimestamp: Seconds? = null,
|
||||||
@SerialName(fileNameField)
|
@SerialName(fileNameField)
|
||||||
override val fileName: String? = null,
|
override val fileName: String? = null,
|
||||||
@SerialName(mimeTypeField)
|
@SerialName(mimeTypeField)
|
||||||
override val mimeType: MimeType? = null,
|
override val mimeType: MimeType? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null
|
override val fileSize: Long? = null
|
||||||
) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile,
|
) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, CoveredMediaFile, CustomStartMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile,
|
||||||
MediaContentVariant, UsefulAsPaidMediaFile
|
MediaContentVariant, UsefulAsPaidMediaFile
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||||
|
|
||||||
|
sealed interface CoveredTelegramMedia : TelegramMedia {
|
||||||
|
val cover: InputFile?
|
||||||
|
}
|
@@ -1,6 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.media
|
package dev.inmo.tgbotapi.types.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.MultipartRequest
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
@@ -70,13 +72,23 @@ data class TelegramMediaVideo internal constructor (
|
|||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(hasSpoilerField)
|
@SerialName(hasSpoilerField)
|
||||||
override val spoilered: Boolean = false,
|
override val spoilered: Boolean = false,
|
||||||
|
@SerialName(coverField)
|
||||||
|
override val cover: InputFile? = null,
|
||||||
|
@SerialName(startTimestampField)
|
||||||
|
override val startTimestamp: Seconds? = null,
|
||||||
@SerialName(showCaptionAboveMediaField)
|
@SerialName(showCaptionAboveMediaField)
|
||||||
override val showCaptionAboveMedia: Boolean = false,
|
override val showCaptionAboveMedia: Boolean = false,
|
||||||
override val width: Int? = null,
|
override val width: Int? = null,
|
||||||
override val height: Int? = null,
|
override val height: Int? = null,
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
override val thumb: InputFile? = null
|
override val thumb: InputFile? = null
|
||||||
) : TelegramFreeMedia, SizedTelegramMedia, DuratedTelegramMedia, ThumbedTelegramMedia, VisualMediaGroupMemberTelegramMedia {
|
) : TelegramFreeMedia,
|
||||||
|
SizedTelegramMedia,
|
||||||
|
DuratedTelegramMedia,
|
||||||
|
ThumbedTelegramMedia,
|
||||||
|
CoveredTelegramMedia,
|
||||||
|
WithCustomStartTelegramMedia,
|
||||||
|
VisualMediaGroupMemberTelegramMedia {
|
||||||
override val type: String = videoTelegramMediaType
|
override val type: String = videoTelegramMediaType
|
||||||
override val textSources: TextSourcesList? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextSources(text ?: return@lazy null)
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
||||||
|
@@ -18,7 +18,16 @@ data class TelegramPaidMediaVideo (
|
|||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(supportsStreamingField)
|
@SerialName(supportsStreamingField)
|
||||||
val supportsStreaming: Boolean = false,
|
val supportsStreaming: Boolean = false,
|
||||||
) : VisualTelegramPaidMedia, SizedTelegramMedia, DuratedTelegramMedia, ThumbedTelegramMedia {
|
@SerialName(coverField)
|
||||||
|
override val cover: InputFile? = null,
|
||||||
|
@SerialName(startTimestampField)
|
||||||
|
override val startTimestamp: Seconds? = null,
|
||||||
|
) : VisualTelegramPaidMedia,
|
||||||
|
SizedTelegramMedia,
|
||||||
|
DuratedTelegramMedia,
|
||||||
|
ThumbedTelegramMedia,
|
||||||
|
CoveredTelegramMedia,
|
||||||
|
WithCustomStartTelegramMedia {
|
||||||
override val type: String = videoTelegramPaidMediaType
|
override val type: String = videoTelegramPaidMediaType
|
||||||
|
|
||||||
@SerialName(mediaField)
|
@SerialName(mediaField)
|
||||||
@@ -31,7 +40,9 @@ fun VideoFile.toTelegramPaidMediaVideo(): TelegramPaidMediaVideo = TelegramPaidM
|
|||||||
thumb = thumbnail ?.fileId,
|
thumb = thumbnail ?.fileId,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
duration = duration
|
duration = duration,
|
||||||
|
cover = cover ?.fileId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun PaidMedia.Video.toTelegramPaidMediaVideo(): TelegramPaidMediaVideo = video.toTelegramPaidMediaVideo()
|
fun PaidMedia.Video.toTelegramPaidMediaVideo(): TelegramPaidMediaVideo = video.toTelegramPaidMediaVideo()
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
|
|
||||||
|
sealed interface WithCustomStartTelegramMedia : TelegramMedia, WithCustomStartMediaData
|
@@ -38,6 +38,8 @@ data class VideoContent(
|
|||||||
entities = textSources,
|
entities = textSources,
|
||||||
showCaptionAboveMedia = showCaptionAboveMedia,
|
showCaptionAboveMedia = showCaptionAboveMedia,
|
||||||
spoilered = spoilered,
|
spoilered = spoilered,
|
||||||
|
cover = media.cover ?.fileId,
|
||||||
|
startTimestamp = media.startTimestamp,
|
||||||
duration = media.duration,
|
duration = media.duration,
|
||||||
width = media.width,
|
width = media.width,
|
||||||
height = media.height,
|
height = media.height,
|
||||||
|
Reference in New Issue
Block a user