1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-15 13:19:30 +00:00

support of protect_content

This commit is contained in:
2022-01-01 20:13:22 +06:00
parent 148791ad68
commit 5c6a430f38
59 changed files with 521 additions and 152 deletions

View File

@@ -1,5 +1,5 @@
package dev.inmo.tgbotapi.CommonAbstracts.types
interface ProtectContent {
val contentProtected: Boolean
val protectContent: Boolean
}

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction
import dev.inmo.tgbotapi.CommonAbstracts.types.ProtectContent
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.types.*
@@ -20,10 +21,11 @@ fun CopyMessage(
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
fun CopyMessage(
fromChatId: ChatIdentifier,
@@ -31,6 +33,7 @@ fun CopyMessage(
messageId: MessageIdentifier,
entities: List<TextSource>,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -42,6 +45,7 @@ fun CopyMessage(
null,
entities.toRawMessageEntities(),
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -63,6 +67,8 @@ data class CopyMessage internal constructor(
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
@@ -72,7 +78,8 @@ data class CopyMessage internal constructor(
): SimpleRequest<MessageIdentifier>,
ReplyingMarkupSendMessageRequest<MessageIdentifier>,
MessageAction,
TextedOutput {
TextedOutput,
ProtectContent {
override val chatId: ChatIdentifier
get() = fromChatId
override val textSources: List<TextSource>? by lazy {

View File

@@ -24,6 +24,8 @@ data class SendContact(
val lastName: String? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
@@ -37,6 +39,7 @@ data class SendContact(
chatId: ChatIdentifier,
contact: Contact,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -46,6 +49,7 @@ data class SendContact(
contact.firstName,
contact.lastName,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -61,6 +65,7 @@ data class SendContact(
fun Contact.toRequest(
chatId: ChatIdentifier,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -68,6 +73,7 @@ fun Contact.toRequest(
chatId,
this,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -22,6 +22,8 @@ data class SendDice(
val animationType: DiceAnimationType? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
@@ -36,4 +38,4 @@ data class SendDice(
override val resultDeserializer: DeserializationStrategy<ContentMessage<DiceContent>>
get() = DiceContentMessageResultDeserializer
}
}

View File

@@ -19,6 +19,7 @@ fun SendLocation(
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -31,6 +32,7 @@ fun SendLocation(
null,
null,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -41,10 +43,11 @@ fun SendStaticLocation(
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = SendLocation(chatId, latitude, longitude, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
fun SendLiveLocation(
chatId: ChatIdentifier,
@@ -55,6 +58,7 @@ fun SendLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -67,6 +71,7 @@ fun SendLiveLocation(
heading,
proximityAlertRadius,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -90,6 +95,8 @@ data class SendLocation internal constructor(
override val proximityAlertRadius: Meters? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -24,6 +24,7 @@ fun SendTextMessage(
parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -34,6 +35,7 @@ fun SendTextMessage(
null,
disableWebPagePreview,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -44,6 +46,7 @@ fun SendTextMessage(
entities: TextSourcesList,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -54,6 +57,7 @@ fun SendTextMessage(
entities.toRawMessageEntities(),
disableWebPagePreview,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -73,6 +77,8 @@ data class SendTextMessage internal constructor(
override val disableWebPagePreview: Boolean? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -34,6 +34,8 @@ data class SendVenue(
val googlePlaceType: GooglePlaceType? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
@@ -49,6 +51,7 @@ data class SendVenue(
chatId: ChatIdentifier,
venue: Venue,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -63,6 +66,7 @@ data class SendVenue(
googlePlaceId = venue.googlePlaceId,
googlePlaceType = venue.googlePlaceType,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
@@ -78,6 +82,7 @@ data class SendVenue(
fun Venue.toRequest(
chatId: ChatIdentifier,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -85,6 +90,7 @@ fun Venue.toRequest(
chatId,
this,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -20,6 +20,8 @@ data class SendGame (
val gameShortName: String,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -27,6 +27,7 @@ fun SendAnimation(
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -47,6 +48,7 @@ fun SendAnimation(
width,
height,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -71,6 +73,7 @@ fun SendAnimation(
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -91,6 +94,7 @@ fun SendAnimation(
width,
height,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -131,6 +135,8 @@ data class SendAnimationData internal constructor(
override val height: Int? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -28,6 +28,7 @@ fun SendAudio(
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -48,6 +49,7 @@ fun SendAudio(
performer,
title,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -72,6 +74,7 @@ fun SendAudio(
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -92,6 +95,7 @@ fun SendAudio(
performer,
title,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -132,6 +136,8 @@ data class SendAudioData internal constructor(
override val title: String? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -33,6 +33,7 @@ fun SendDocument(
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
@@ -51,6 +52,7 @@ fun SendDocument(
parseMode,
null,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup,
@@ -82,6 +84,7 @@ fun SendDocument(
thumb: InputFile? = null,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
@@ -100,6 +103,7 @@ fun SendDocument(
null,
entities.toRawMessageEntities(),
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup,
@@ -144,6 +148,8 @@ data class SendDocumentData internal constructor(
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -25,6 +25,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
chatId: ChatIdentifier,
media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
): Request<List<MediaGroupMessage<T>>> {
@@ -47,6 +48,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
chatId,
media,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply
)
@@ -71,9 +73,10 @@ inline fun SendPlaylist(
chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<AudioContent>(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
) = SendMediaGroup<AudioContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Use this method to be sure that you are correctly sending documents media group
@@ -85,9 +88,10 @@ inline fun SendDocumentsGroup(
chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<DocumentContent>(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
) = SendMediaGroup<DocumentContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Use this method to be sure that you are correctly sending visual media group
@@ -100,9 +104,10 @@ inline fun SendVisualMediaGroup(
chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
private val messagesListSerializer: KSerializer<List<MediaGroupMessage<MediaGroupContent>>>
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
@@ -114,6 +119,8 @@ data class SendMediaGroupData internal constructor(
val media: List<MediaGroupMemberInputMedia> = emptyList(),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -22,6 +22,7 @@ fun SendPhoto(
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -33,6 +34,7 @@ fun SendPhoto(
parseMode,
null,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -50,6 +52,7 @@ fun SendPhoto(
photo: InputFile,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -61,6 +64,7 @@ fun SendPhoto(
null,
entities.toRawMessageEntities(),
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -90,6 +94,8 @@ data class SendPhotoData internal constructor(
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -16,6 +16,7 @@ fun SendSticker(
chatId: ChatIdentifier,
sticker: InputFile,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -23,6 +24,7 @@ fun SendSticker(
chatId,
sticker as? FileId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor(
val sticker: FileId? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -28,6 +28,7 @@ fun SendVideo(
height: Int? = null,
supportStreaming: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -49,6 +50,7 @@ fun SendVideo(
height,
supportStreaming,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -74,6 +76,7 @@ fun SendVideo(
height: Int? = null,
supportStreaming: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -95,6 +98,7 @@ fun SendVideo(
height,
supportStreaming,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -137,6 +141,8 @@ data class SendVideoData internal constructor(
val supportStreaming: Boolean? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -18,6 +18,7 @@ fun SendVideoNote(
duration: Long? = null,
size: Int? = null, // in documentation - length (size of video side)
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -34,6 +35,7 @@ fun SendVideoNote(
duration,
size,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -66,6 +68,8 @@ data class SendVideoNoteData internal constructor(
override val width: Int? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -24,6 +24,7 @@ fun SendVoice(
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -39,6 +40,7 @@ fun SendVoice(
null,
duration,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -60,6 +62,7 @@ fun SendVoice(
entities: TextSourcesList,
duration: Long? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -75,6 +78,7 @@ fun SendVoice(
entities.toRawMessageEntities(),
duration,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -109,6 +113,8 @@ data class SendVoiceData internal constructor(
override val duration: Long? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -60,6 +60,8 @@ data class SendInvoice(
override val priceDependOnShipAddress: Boolean = false,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -47,6 +47,7 @@ fun SendPoll(
isAnonymous: Boolean = true,
isClosed: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -69,6 +70,7 @@ fun SendPoll(
fun Poll.createRequest(
chatId: ChatIdentifier,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -82,6 +84,7 @@ fun Poll.createRequest(
allowMultipleAnswers,
scheduledCloseInfo,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -97,6 +100,7 @@ fun Poll.createRequest(
textSources,
scheduledCloseInfo,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -110,6 +114,7 @@ fun Poll.createRequest(
false,
scheduledCloseInfo,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -123,6 +128,7 @@ fun Poll.createRequest(
false,
scheduledCloseInfo,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -187,6 +193,8 @@ data class SendRegularPoll(
override val closeDate: LongSeconds?,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
@@ -213,6 +221,7 @@ fun SendRegularPoll(
allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -226,6 +235,7 @@ fun SendRegularPoll(
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -242,6 +252,7 @@ fun SendQuizPoll(
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -257,6 +268,7 @@ fun SendQuizPoll(
null,
closeInfo,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -272,6 +284,7 @@ fun SendQuizPoll(
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -287,6 +300,7 @@ fun SendQuizPoll(
entities.toRawMessageEntities(),
closeInfo,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -304,6 +318,7 @@ internal fun SendQuizPoll(
rawEntities: List<RawMessageEntity>? = null,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
@@ -320,6 +335,7 @@ internal fun SendQuizPoll(
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -351,6 +367,8 @@ data class SendQuizPoll internal constructor(
override val closeDate: LongSeconds? = null,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)

View File

@@ -102,6 +102,7 @@ const val updateIdField = "update_id"
const val fromChatIdField = "from_chat_id"
const val disableWebPagePreviewField = "disable_web_page_preview"
const val disableNotificationField = "disable_notification"
const val protectContentField = "protect_content"
const val replyToMessageIdField = "reply_to_message_id"
const val allowSendingWithoutReplyField = "allow_sending_without_reply"
const val replyMarkupField = "reply_markup"

View File

@@ -15,10 +15,11 @@ data class ContactContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<ContactContent>> = SendContact(
chatId, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, contact, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
}

View File

@@ -17,6 +17,7 @@ data class DiceContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -24,6 +25,7 @@ data class DiceContent(
chatId,
dice.animationType,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -17,6 +17,7 @@ data class GameContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -24,6 +25,7 @@ data class GameContent(
chatId,
game.title,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -101,6 +101,7 @@ data class LiveLocationContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -113,6 +114,7 @@ data class LiveLocationContent(
location.heading,
location.proximityAlertRadius,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
@@ -130,6 +132,7 @@ data class StaticLocationContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -138,6 +141,7 @@ data class StaticLocationContent(
location.latitude,
location.longitude,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -17,12 +17,14 @@ data class PollContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<PollContent>> = poll.createRequest(
chatId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -19,6 +19,7 @@ data class TextContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -27,6 +28,7 @@ data class TextContent(
textSources,
false,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -17,10 +17,11 @@ data class VenueContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VenueContent>> = SendVenue(
chatId, venue, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, venue, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
}

View File

@@ -10,8 +10,9 @@ interface ResendableContent {
fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): Request<out Message>
}
}

View File

@@ -24,6 +24,7 @@ data class AnimationContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -36,6 +37,7 @@ data class AnimationContent(
media.width,
media.height,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -22,6 +22,7 @@ data class AudioContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -34,6 +35,7 @@ data class AudioContent(
media.performer,
media.title,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -25,6 +25,7 @@ data class DocumentContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -34,6 +35,7 @@ data class DocumentContent(
media.thumb ?.fileId,
textSources,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -25,6 +25,7 @@ data class PhotoContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -33,6 +34,7 @@ data class PhotoContent(
media.fileId,
textSources,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -18,6 +18,7 @@ data class StickerContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -25,6 +26,7 @@ data class StickerContent(
chatId,
media.fileId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -22,6 +22,7 @@ data class VideoContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -35,6 +36,7 @@ data class VideoContent(
media.height,
null,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -18,6 +18,7 @@ data class VideoNoteContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -28,6 +29,7 @@ data class VideoNoteContent(
media.duration,
media.width,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -22,6 +22,7 @@ data class VoiceContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?
@@ -31,6 +32,7 @@ data class VoiceContent(
textSources,
media.duration,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup

View File

@@ -16,6 +16,7 @@ data class InvoiceContent(
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
protectContent: Boolean,
replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?