1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

add base support of effects

This commit is contained in:
InsanusMokrassar 2024-05-30 21:58:47 +06:00
parent 4dec85ee60
commit 7a5c9c7ef8
27 changed files with 362 additions and 188 deletions

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, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
@ -46,6 +48,7 @@ data class SendContact(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): this( ): this(
@ -57,6 +60,7 @@ data class SendContact(
businessConnectionId, businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId,
replyParameters, replyParameters,
replyMarkup replyMarkup
) )
@ -74,15 +78,17 @@ fun Contact.toRequest(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): SendContact = SendContact( ): SendContact = SendContact(
chatId, chatId = chatId,
this, contact = this,
threadId, threadId = threadId,
businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification, disableNotification = disableNotification,
protectContent, protectContent = protectContent,
replyParameters, effectId = effectId,
replyMarkup 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.OptionallyBusinessConnectionRequest
import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest 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.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@ -30,11 +31,13 @@ data class SendDice(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, WithReplyParameters, DisableNotification, ) : SendContentMessageRequest<ContentMessage<DiceContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, WithReplyParameters, DisableNotification,
OptionallyBusinessConnectionRequest { OptionallyBusinessConnectionRequest {
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()

View File

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

View File

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

View File

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

View File

@ -36,6 +36,7 @@ fun SendAnimation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> { ): Request<ContentMessage<AnimationContent>> {
@ -58,6 +59,7 @@ fun SendAnimation(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@ -86,6 +88,7 @@ fun SendAnimation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> { ): Request<ContentMessage<AnimationContent>> {
@ -108,6 +111,7 @@ fun SendAnimation(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@ -157,6 +161,8 @@ data class SendAnimationData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)

View File

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

View File

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

View File

@ -37,8 +37,8 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null replyParameters: ReplyParameters? = null
): Request<ContentMessage<MediaGroupContent<T>>> { ): Request<ContentMessage<MediaGroupContent<T>>> {
if (media.size !in mediaCountInMediaGroup) { if (media.size !in mediaCountInMediaGroup) {
throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size) throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size)
@ -56,13 +56,14 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
} }
val data = SendMediaGroupData( val data = SendMediaGroupData(
chatId, chatId = chatId,
media, media = media,
threadId, threadId = threadId,
businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification, disableNotification = disableNotification,
protectContent, protectContent = protectContent,
replyParameters effectId = effectId,
replyParameters = replyParameters
) )
return (if (files.isEmpty()) { return (if (files.isEmpty()) {
@ -88,9 +89,18 @@ inline fun SendPlaylist(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null replyParameters: ReplyParameters? = null
) = SendMediaGroup<AudioContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) ) = 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 * 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, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null replyParameters: ReplyParameters? = null
) = SendMediaGroup<DocumentContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) ) = 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 * 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, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null ) = SendMediaGroup<VisualMediaGroupPartContent>(
) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) chatId = chatId,
media = media,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters
)
private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> { private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>()) private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>())
@ -155,6 +183,8 @@ data class SendMediaGroupData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>, ) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>,

View File

@ -31,6 +31,7 @@ fun SendPhoto(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> { ): Request<ContentMessage<PhotoContent>> {
@ -46,6 +47,7 @@ fun SendPhoto(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@ -69,6 +71,7 @@ fun SendPhoto(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> { ): Request<ContentMessage<PhotoContent>> {
@ -84,6 +87,7 @@ fun SendPhoto(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@ -125,6 +129,8 @@ data class SendPhotoData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)

View File

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

View File

@ -37,6 +37,7 @@ fun SendVideo(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> { ): Request<ContentMessage<VideoContent>> {
@ -60,6 +61,7 @@ fun SendVideo(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@ -89,6 +91,7 @@ fun SendVideo(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> { ): Request<ContentMessage<VideoContent>> {
@ -112,6 +115,7 @@ fun SendVideo(
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@ -163,6 +167,8 @@ data class SendVideoData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)

View File

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

View File

@ -31,24 +31,26 @@ fun SendVoice(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> { ): Request<ContentMessage<VoiceContent>> {
val voiceAsFile = voice as? MultipartFile val voiceAsFile = voice as? MultipartFile
val data = SendVoiceData( val data = SendVoiceData(
chatId, chatId = chatId,
voice, voice = voice,
text, text = text,
parseMode, parseMode = parseMode,
null, rawEntities = null,
duration, duration = duration,
threadId, threadId = threadId,
businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification, disableNotification = disableNotification,
protectContent, protectContent = protectContent,
replyParameters, effectId = effectId,
replyMarkup replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
return if (voiceAsFile == null) { return if (voiceAsFile == null) {
@ -70,24 +72,26 @@ fun SendVoice(
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> { ): Request<ContentMessage<VoiceContent>> {
val voiceAsFile = voice as? MultipartFile val voiceAsFile = voice as? MultipartFile
val data = SendVoiceData( val data = SendVoiceData(
chatId, chatId = chatId,
voice, voice = voice,
entities.makeString(), text = entities.makeString(),
null, parseMode = null,
entities.toRawMessageEntities(), rawEntities = entities.toRawMessageEntities(),
duration, duration = duration,
threadId, threadId = threadId,
businessConnectionId, businessConnectionId = businessConnectionId,
disableNotification, disableNotification = disableNotification,
protectContent, protectContent = protectContent,
replyParameters, effectId = effectId,
replyMarkup replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
return if (voiceAsFile == null) { return if (voiceAsFile == null) {
@ -125,6 +129,8 @@ data class SendVoiceData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @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.CommonSendInvoiceData
import dev.inmo.tgbotapi.abstracts.types.* 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.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
@ -66,6 +67,8 @@ data class SendInvoice(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false, override val protectContent: Boolean = false,
@SerialName(messageEffectIdField)
override val effectId: EffectId? = null,
@SerialName(replyParametersField) @SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null, override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
@ -75,7 +78,8 @@ data class SendInvoice(
DisableNotification, DisableNotification,
WithReplyParameters, WithReplyParameters,
WithReplyMarkup, WithReplyMarkup,
SendMessageRequest<ContentMessage<InvoiceContent>> { SendMessageRequest<ContentMessage<InvoiceContent>>,
OptionallyWithEffectRequest<ContentMessage<InvoiceContent>> {
override fun method(): String = "sendInvoice" override fun method(): String = "sendInvoice"
override val resultDeserializer: DeserializationStrategy<ContentMessage<InvoiceContent>> override val resultDeserializer: DeserializationStrategy<ContentMessage<InvoiceContent>>
get() = invoiceMessageSerializer get() = invoiceMessageSerializer
@ -115,6 +119,7 @@ data class SendInvoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) : this( ) : this(
@ -138,6 +143,7 @@ data class SendInvoice(
threadId = threadId, threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )

View File

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

View File

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

View File

@ -24,6 +24,7 @@ data class PrivateContentMessageImpl<T: MessageContent>(
override val senderBot: CommonBot?, override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?, override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean, override val fromOffline: Boolean,
override val effectId: EffectId?
) : PrivateContentMessage<T> { ) : PrivateContentMessage<T> {
constructor( constructor(
messageId: MessageId, messageId: MessageId,
@ -39,7 +40,8 @@ data class PrivateContentMessageImpl<T: MessageContent>(
senderBot: CommonBot?, senderBot: CommonBot?,
mediaGroupId: MediaGroupId?, mediaGroupId: MediaGroupId?,
fromOffline: Boolean, fromOffline: Boolean,
effectId: EffectId,
) : this( ) : 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, replyMarkup = reply_markup,
senderBot = via_bot, senderBot = via_bot,
mediaGroupId = media_group_id, mediaGroupId = media_group_id,
fromOffline = is_from_offline fromOffline = is_from_offline,
effectId = effect_id
) )
} else { } else {
BusinessContentMessageImpl( 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.chat.PreviewPrivateChat
import dev.inmo.tgbotapi.types.message.content.MessageContent 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 override val chat: PreviewPrivateChat
} }

View File

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