2020-10-04 10:57:39 +00:00
|
|
|
package dev.inmo.tgbotapi.extensions.api.send.media
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
2020-11-02 06:39:12 +00:00
|
|
|
import dev.inmo.tgbotapi.requests.send.media.*
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
2022-04-22 07:54:06 +00:00
|
|
|
import dev.inmo.tgbotapi.types.media.*
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
2022-04-21 18:16:41 +00:00
|
|
|
import dev.inmo.tgbotapi.types.chat.Chat
|
2022-05-01 05:52:02 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.AudioContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.DocumentContent
|
2020-11-02 06:39:12 +00:00
|
|
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
2022-01-12 05:39:35 +00:00
|
|
|
import kotlin.jvm.JvmName
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-11-02 06:39:12 +00:00
|
|
|
/**
|
|
|
|
* @see SendMediaGroup
|
|
|
|
*/
|
|
|
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendMediaGroup(
|
2020-02-15 09:33:04 +00:00
|
|
|
chatId: ChatIdentifier,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<MediaGroupMemberTelegramMedia>,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-02-15 09:33:04 +00:00
|
|
|
) = execute(
|
2021-01-19 04:52:30 +00:00
|
|
|
SendMediaGroup<MediaGroupContent>(
|
2022-01-01 14:13:22 +00:00
|
|
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2020-11-02 06:39:12 +00:00
|
|
|
/**
|
|
|
|
* @see SendMediaGroup
|
|
|
|
*/
|
|
|
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendMediaGroup(
|
2020-02-15 09:33:04 +00:00
|
|
|
chat: Chat,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<MediaGroupMemberTelegramMedia>,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-02-15 09:33:04 +00:00
|
|
|
) = sendMediaGroup(
|
2022-01-01 14:13:22 +00:00
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
2020-10-04 10:47:30 +00:00
|
|
|
|
2022-01-12 05:39:35 +00:00
|
|
|
/**
|
|
|
|
* @see SendMediaGroup
|
|
|
|
*/
|
|
|
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
|
|
|
@JvmName("sendMedaGroupByContent")
|
|
|
|
suspend fun TelegramBot.sendMediaGroup(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
media: List<MediaGroupContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendMediaGroup(
|
2022-04-22 07:54:06 +00:00
|
|
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2022-01-12 05:39:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendMediaGroup
|
|
|
|
*/
|
|
|
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
|
|
|
@JvmName("sendMedaGroupByContent")
|
|
|
|
suspend fun TelegramBot.sendMediaGroup(
|
|
|
|
chat: Chat,
|
|
|
|
media: List<MediaGroupContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendMediaGroup(
|
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
|
|
|
)
|
|
|
|
|
2020-11-02 06:39:12 +00:00
|
|
|
/**
|
|
|
|
* @see SendPlaylist
|
|
|
|
*/
|
|
|
|
suspend fun TelegramBot.sendPlaylist(
|
|
|
|
chatId: ChatIdentifier,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<AudioMediaGroupMemberTelegramMedia>,
|
2020-11-02 06:39:12 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-11-02 06:39:12 +00:00
|
|
|
) = execute(
|
|
|
|
SendPlaylist(
|
2022-01-01 14:13:22 +00:00
|
|
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-11-02 06:39:12 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendPlaylist
|
|
|
|
*/
|
|
|
|
suspend fun TelegramBot.sendPlaylist(
|
|
|
|
chat: Chat,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<AudioMediaGroupMemberTelegramMedia>,
|
2020-11-02 06:39:12 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-11-02 06:39:12 +00:00
|
|
|
) = sendPlaylist(
|
2022-01-01 14:13:22 +00:00
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-11-02 06:39:12 +00:00
|
|
|
)
|
|
|
|
|
2022-01-12 05:39:35 +00:00
|
|
|
/**
|
|
|
|
* @see SendPlaylist
|
|
|
|
*/
|
|
|
|
@JvmName("sendPlaylistByContent")
|
|
|
|
suspend fun TelegramBot.sendPlaylist(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
media: List<AudioContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendPlaylist(
|
2022-04-22 07:54:06 +00:00
|
|
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2022-01-12 05:39:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendPlaylist
|
|
|
|
*/
|
|
|
|
@JvmName("sendPlaylistByContent")
|
|
|
|
suspend fun TelegramBot.sendPlaylist(
|
|
|
|
chat: Chat,
|
|
|
|
media: List<AudioContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendPlaylist(
|
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
|
|
|
)
|
|
|
|
|
2020-11-02 06:39:12 +00:00
|
|
|
/**
|
|
|
|
* @see SendDocumentsGroup
|
|
|
|
*/
|
|
|
|
suspend fun TelegramBot.sendDocumentsGroup(
|
|
|
|
chatId: ChatIdentifier,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
2020-11-02 06:39:12 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-11-02 06:39:12 +00:00
|
|
|
) = execute(
|
|
|
|
SendDocumentsGroup(
|
2022-01-01 14:13:22 +00:00
|
|
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-11-02 06:39:12 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendDocumentsGroup
|
|
|
|
*/
|
|
|
|
suspend fun TelegramBot.sendDocumentsGroup(
|
|
|
|
chat: Chat,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
2020-11-02 06:39:12 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-11-02 06:39:12 +00:00
|
|
|
) = sendDocumentsGroup(
|
2022-01-01 14:13:22 +00:00
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-11-02 06:39:12 +00:00
|
|
|
)
|
|
|
|
|
2022-01-12 05:39:35 +00:00
|
|
|
/**
|
|
|
|
* @see SendDocumentsGroup
|
|
|
|
*/
|
|
|
|
@JvmName("sendDocumentsByContent")
|
|
|
|
suspend fun TelegramBot.sendDocumentsGroup(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
media: List<DocumentContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendDocumentsGroup(
|
2022-04-22 07:54:06 +00:00
|
|
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2022-01-12 05:39:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendDocumentsGroup
|
|
|
|
*/
|
|
|
|
@JvmName("sendDocumentsByContent")
|
|
|
|
suspend fun TelegramBot.sendDocumentsGroup(
|
|
|
|
chat: Chat,
|
|
|
|
media: List<DocumentContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendDocumentsGroup(
|
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
|
|
|
)
|
|
|
|
|
2020-11-02 06:39:12 +00:00
|
|
|
/**
|
|
|
|
* @see SendVisualMediaGroup
|
|
|
|
*/
|
|
|
|
suspend fun TelegramBot.sendVisualMediaGroup(
|
|
|
|
chatId: ChatIdentifier,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<VisualMediaGroupMemberTelegramMedia>,
|
2020-11-02 06:39:12 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-11-02 06:39:12 +00:00
|
|
|
) = execute(
|
|
|
|
SendVisualMediaGroup(
|
2022-01-01 14:13:22 +00:00
|
|
|
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-11-02 06:39:12 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendVisualMediaGroup
|
|
|
|
*/
|
|
|
|
suspend fun TelegramBot.sendVisualMediaGroup(
|
|
|
|
chat: Chat,
|
2022-04-22 07:54:06 +00:00
|
|
|
media: List<VisualMediaGroupMemberTelegramMedia>,
|
2020-11-02 06:39:12 +00:00
|
|
|
disableNotification: Boolean = false,
|
2022-01-01 14:13:22 +00:00
|
|
|
protectContent: Boolean = false,
|
2020-11-05 17:48:23 +00:00
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
2020-11-02 06:39:12 +00:00
|
|
|
) = sendVisualMediaGroup(
|
2022-01-01 14:13:22 +00:00
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2020-11-02 06:39:12 +00:00
|
|
|
)
|
2022-01-12 05:39:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendVisualMediaGroup
|
|
|
|
*/
|
|
|
|
@JvmName("sendVisualMediaGroupByContent")
|
|
|
|
suspend fun TelegramBot.sendVisualMediaGroup(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
media: List<VisualMediaGroupContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendVisualMediaGroup(
|
2022-04-22 07:54:06 +00:00
|
|
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
2022-01-12 05:39:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see SendVisualMediaGroup
|
|
|
|
*/
|
|
|
|
@JvmName("sendVisualMediaGroupByContent")
|
|
|
|
suspend fun TelegramBot.sendVisualMediaGroup(
|
|
|
|
chat: Chat,
|
|
|
|
media: List<VisualMediaGroupContent>,
|
|
|
|
disableNotification: Boolean = false,
|
|
|
|
protectContent: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
allowSendingWithoutReply: Boolean? = null
|
|
|
|
) = sendVisualMediaGroup(
|
|
|
|
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
|
|
|
)
|