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

Compare commits

...

2 Commits

Author SHA1 Message Date
8de41bdd99 complete effects in core part 2024-05-30 22:13:18 +06:00
7a5c9c7ef8 add base support of effects 2024-05-30 21:58:47 +06:00
53 changed files with 599 additions and 335 deletions

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

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

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

@@ -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

@@ -36,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>> {
@@ -58,6 +59,7 @@ fun SendAnimation(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -86,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>> {
@@ -108,6 +111,7 @@ fun SendAnimation(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -157,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)

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

@@ -31,6 +31,7 @@ fun SendPhoto(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> {
@@ -46,6 +47,7 @@ fun SendPhoto(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -69,6 +71,7 @@ fun SendPhoto(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> {
@@ -84,6 +87,7 @@ fun SendPhoto(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -125,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)

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

@@ -37,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>> {
@@ -60,6 +61,7 @@ fun SendVideo(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -89,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>> {
@@ -112,6 +115,7 @@ fun SendVideo(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -163,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)

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

@@ -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
@@ -66,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)
@@ -75,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
@@ -115,6 +119,7 @@ data class SendInvoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) : this(
@@ -138,6 +143,7 @@ data class SendInvoice(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

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"

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

@@ -553,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

@@ -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

@@ -153,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>
@@ -163,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
@@ -172,6 +174,7 @@ sealed interface ResendableContent {
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyToMessageId ?.let {
ReplyParameters(
chatId,

View File

@@ -28,6 +28,7 @@ data class AnimationContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<AnimationContent>> = SendAnimation(
@@ -44,6 +45,7 @@ data class AnimationContent(
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

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

@@ -30,6 +30,7 @@ data class PhotoContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<PhotoContent>> = SendPhoto(
@@ -42,6 +43,7 @@ data class PhotoContent(
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.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

@@ -27,6 +27,7 @@ data class VideoContent(
businessConnectionId: BusinessConnectionId?,
disableNotification: Boolean,
protectContent: Boolean,
effectId: EffectId?,
replyParameters: ReplyParameters?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VideoContent>> = SendVideo(
@@ -44,6 +45,7 @@ data class VideoContent(
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.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

@@ -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,

View File

@@ -46,6 +46,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.Thumbed
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedWithMimeTypeInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.TitledInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.UrlInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithCustomizableCaptionInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithInputMessageContentInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
@@ -228,6 +229,7 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.media.TitledTelegramMedia
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
import dev.inmo.tgbotapi.types.media.WithCustomizableCaptionTelegramMedia
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
import dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
@@ -295,6 +297,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.PossiblyOfflineMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyWithEffectMessage
import dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage
@@ -336,6 +339,7 @@ import dev.inmo.tgbotapi.types.message.content.VideoContent
import dev.inmo.tgbotapi.types.message.content.VideoNoteContent
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.VoiceContent
import dev.inmo.tgbotapi.types.message.content.WithCustomizedCaptionMediaContent
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
import dev.inmo.tgbotapi.types.message.textsources.BlockquoteTextSource
import dev.inmo.tgbotapi.types.message.textsources.BoldTextSource
@@ -344,6 +348,7 @@ import dev.inmo.tgbotapi.types.message.textsources.CashTagTextSource
import dev.inmo.tgbotapi.types.message.textsources.CodeTextSource
import dev.inmo.tgbotapi.types.message.textsources.CustomEmojiTextSource
import dev.inmo.tgbotapi.types.message.textsources.EMailTextSource
import dev.inmo.tgbotapi.types.message.textsources.ExpandableBlockquoteTextSource
import dev.inmo.tgbotapi.types.message.textsources.HashTagTextSource
import dev.inmo.tgbotapi.types.message.textsources.ItalicTextSource
import dev.inmo.tgbotapi.types.message.textsources.MentionTextSource
@@ -1413,6 +1418,18 @@ public inline fun InlineQueryResult.urlInlineQueryResultOrThrow(): UrlInlineQuer
public inline fun <T> InlineQueryResult.ifUrlInlineQueryResult(block: (UrlInlineQueryResult) -> T):
T? = urlInlineQueryResultOrNull() ?.let(block)
public inline fun InlineQueryResult.withCustomizableCaptionInlineQueryResultOrNull():
WithCustomizableCaptionInlineQueryResult? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithCustomizableCaptionInlineQueryResult
public inline fun InlineQueryResult.withCustomizableCaptionInlineQueryResultOrThrow():
WithCustomizableCaptionInlineQueryResult = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithCustomizableCaptionInlineQueryResult
public inline fun <T>
InlineQueryResult.ifWithCustomizableCaptionInlineQueryResult(block: (WithCustomizableCaptionInlineQueryResult) -> T):
T? = withCustomizableCaptionInlineQueryResultOrNull() ?.let(block)
public inline fun InlineQueryResult.withInputMessageContentInlineQueryResultOrNull():
WithInputMessageContentInlineQueryResult? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithInputMessageContentInlineQueryResult
@@ -3064,6 +3081,18 @@ public inline fun TelegramMedia.titledTelegramMediaOrThrow(): TitledTelegramMedi
public inline fun <T> TelegramMedia.ifTitledTelegramMedia(block: (TitledTelegramMedia) -> T): T? =
titledTelegramMediaOrNull() ?.let(block)
public inline fun TelegramMedia.withCustomizableCaptionTelegramMediaOrNull():
WithCustomizableCaptionTelegramMedia? = this as?
dev.inmo.tgbotapi.types.media.WithCustomizableCaptionTelegramMedia
public inline fun TelegramMedia.withCustomizableCaptionTelegramMediaOrThrow():
WithCustomizableCaptionTelegramMedia = this as
dev.inmo.tgbotapi.types.media.WithCustomizableCaptionTelegramMedia
public inline fun <T>
TelegramMedia.ifWithCustomizableCaptionTelegramMedia(block: (WithCustomizableCaptionTelegramMedia) -> T):
T? = withCustomizableCaptionTelegramMediaOrNull() ?.let(block)
public inline fun ChatEvent.chatBackgroundOrNull(): ChatBackground? = this as?
dev.inmo.tgbotapi.types.chat.ChatBackground
@@ -3842,6 +3871,15 @@ public inline fun Message.possiblyTopicMessageOrThrow(): PossiblyTopicMessage =
public inline fun <T> Message.ifPossiblyTopicMessage(block: (PossiblyTopicMessage) -> T): T? =
possiblyTopicMessageOrNull() ?.let(block)
public inline fun Message.possiblyWithEffectMessageOrNull(): PossiblyWithEffectMessage? = this as?
dev.inmo.tgbotapi.types.message.abstracts.PossiblyWithEffectMessage
public inline fun Message.possiblyWithEffectMessageOrThrow(): PossiblyWithEffectMessage = this as
dev.inmo.tgbotapi.types.message.abstracts.PossiblyWithEffectMessage
public inline fun <T> Message.ifPossiblyWithEffectMessage(block: (PossiblyWithEffectMessage) -> T):
T? = possiblyWithEffectMessageOrNull() ?.let(block)
public inline fun Message.privateContentMessageOrNull(): PrivateContentMessage<MessageContent>? =
this as?
dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
@@ -3936,6 +3974,18 @@ public inline fun <T>
ResendableContent.ifSpoilerableMediaContent(block: (SpoilerableMediaContent) -> T): T? =
spoilerableMediaContentOrNull() ?.let(block)
public inline fun ResendableContent.withCustomizedCaptionMediaContentOrNull():
WithCustomizedCaptionMediaContent? = this as?
dev.inmo.tgbotapi.types.message.content.WithCustomizedCaptionMediaContent
public inline fun ResendableContent.withCustomizedCaptionMediaContentOrThrow():
WithCustomizedCaptionMediaContent = this as
dev.inmo.tgbotapi.types.message.content.WithCustomizedCaptionMediaContent
public inline fun <T>
ResendableContent.ifWithCustomizedCaptionMediaContent(block: (WithCustomizedCaptionMediaContent) -> T):
T? = withCustomizedCaptionMediaContentOrNull() ?.let(block)
public inline fun ResendableContent.audioMediaGroupPartContentOrNull(): AudioMediaGroupPartContent?
= this as? dev.inmo.tgbotapi.types.message.content.AudioMediaGroupPartContent
@@ -4269,6 +4319,16 @@ public inline fun TextSource.eMailTextSourceOrThrow(): EMailTextSource = this as
public inline fun <T> TextSource.ifEMailTextSource(block: (EMailTextSource) -> T): T? =
eMailTextSourceOrNull() ?.let(block)
public inline fun TextSource.expandableBlockquoteTextSourceOrNull(): ExpandableBlockquoteTextSource?
= this as? dev.inmo.tgbotapi.types.message.textsources.ExpandableBlockquoteTextSource
public inline fun TextSource.expandableBlockquoteTextSourceOrThrow(): ExpandableBlockquoteTextSource
= this as dev.inmo.tgbotapi.types.message.textsources.ExpandableBlockquoteTextSource
public inline fun <T>
TextSource.ifExpandableBlockquoteTextSource(block: (ExpandableBlockquoteTextSource) -> T): T? =
expandableBlockquoteTextSourceOrNull() ?.let(block)
public inline fun TextSource.hashTagTextSourceOrNull(): HashTagTextSource? = this as?
dev.inmo.tgbotapi.types.message.textsources.HashTagTextSource