1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

implementation of allow sending without reply (#191)

This commit is contained in:
InsanusMokrassar 2020-11-05 21:33:11 +06:00
parent 6bdefb6f8f
commit 765caefc32
20 changed files with 113 additions and 12 deletions

View File

@ -4,4 +4,5 @@ import dev.inmo.tgbotapi.types.MessageIdentifier
interface ReplyMessageId { interface ReplyMessageId {
val replyToMessageId: MessageIdentifier? val replyToMessageId: MessageIdentifier?
val allowSendingWithoutReply: Boolean?
} }

View File

@ -25,8 +25,9 @@ fun CopyMessage(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, replyToMessageId, replyMarkup) ) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
fun CopyMessage( fun CopyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
@ -35,8 +36,9 @@ fun CopyMessage(
entities: List<TextSource>, entities: List<TextSource>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = CopyMessage(fromChatId, toChatId, messageId, entities.makeString(), null, entities.toRawMessageEntities(), disableNotification, replyToMessageId, replyMarkup) ) = CopyMessage(fromChatId, toChatId, messageId, entities.makeString(), null, entities.toRawMessageEntities(), disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
@Serializable @Serializable
data class CopyMessage internal constructor( data class CopyMessage internal constructor(
@ -56,6 +58,8 @@ data class CopyMessage internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
): SimpleRequest<ContentMessage<*>>, ): SimpleRequest<ContentMessage<*>>,

View File

@ -26,6 +26,8 @@ data class SendContact(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<ContactContent>>, ) : SendMessageRequest<ContentMessage<ContactContent>>,
@ -36,6 +38,7 @@ data class SendContact(
contact: Contact, contact: Contact,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): this( ): this(
chatId, chatId,
@ -44,6 +47,7 @@ data class SendContact(
contact.lastName, contact.lastName,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -58,11 +62,13 @@ fun Contact.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): SendContact = SendContact( ): SendContact = SendContact(
chatId, chatId,
this, this,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -24,6 +24,8 @@ data class SendDice(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, ReplyMessageId, DisableNotification { ) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, ReplyMessageId, DisableNotification {

View File

@ -20,6 +20,7 @@ fun SendLocation(
longitude: Double, longitude: Double,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendLocation( ) = SendLocation(
chatId, chatId,
@ -31,6 +32,7 @@ fun SendLocation(
null, null,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -40,8 +42,9 @@ fun SendStaticLocation(
longitude: Double, longitude: Double,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, replyMarkup) ) = SendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
fun SendLiveLocation( fun SendLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -53,6 +56,7 @@ fun SendLiveLocation(
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendLocation( ) = SendLocation(
chatId, chatId,
@ -64,6 +68,7 @@ fun SendLiveLocation(
proximityAlertRadius, proximityAlertRadius,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -87,6 +92,8 @@ data class SendLocation internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<LocationContent>>, ) : SendMessageRequest<ContentMessage<LocationContent>>,

View File

@ -26,6 +26,7 @@ fun SendTextMessage(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendTextMessage( ) = SendTextMessage(
chatId, chatId,
@ -35,6 +36,7 @@ fun SendTextMessage(
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -44,6 +46,7 @@ fun SendTextMessage(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendTextMessage( ) = SendTextMessage(
chatId, chatId,
@ -53,6 +56,7 @@ fun SendTextMessage(
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -72,6 +76,8 @@ data class SendTextMessage internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<TextContent>>, ) : SendMessageRequest<ContentMessage<TextContent>>,

View File

@ -30,6 +30,8 @@ data class SendVenue(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<VenueContent>>, ) : SendMessageRequest<ContentMessage<VenueContent>>,
@ -42,6 +44,7 @@ data class SendVenue(
venue: Venue, venue: Venue,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): this( ): this(
chatId, chatId,
@ -52,6 +55,7 @@ data class SendVenue(
venue.foursquareId, venue.foursquareId,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -66,11 +70,13 @@ fun Venue.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): SendVenue = SendVenue( ): SendVenue = SendVenue(
chatId, chatId,
this, this,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -22,6 +22,8 @@ data class SendGame (
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<GameContent>>, ) : SendMessageRequest<ContentMessage<GameContent>>,

View File

@ -29,6 +29,7 @@ fun SendAnimation(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> { ): Request<ContentMessage<AnimationContent>> {
val animationAsFileId = (animation as? FileId) ?.fileId val animationAsFileId = (animation as? FileId) ?.fileId
@ -48,6 +49,7 @@ fun SendAnimation(
height, height,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -71,6 +73,7 @@ fun SendAnimation(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> { ): Request<ContentMessage<AnimationContent>> {
val animationAsFileId = (animation as? FileId) ?.fileId val animationAsFileId = (animation as? FileId) ?.fileId
@ -90,6 +93,7 @@ fun SendAnimation(
height, height,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -130,6 +134,8 @@ data class SendAnimationData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<AnimationContent>>, ) : DataRequest<ContentMessage<AnimationContent>>,

View File

@ -29,6 +29,7 @@ fun SendAudio(
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AudioContent>> { ): Request<ContentMessage<AudioContent>> {
val audioAsFileId = (audio as? FileId) ?.fileId val audioAsFileId = (audio as? FileId) ?.fileId
@ -48,6 +49,7 @@ fun SendAudio(
title, title,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -71,6 +73,7 @@ fun SendAudio(
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AudioContent>> { ): Request<ContentMessage<AudioContent>> {
val audioAsFileId = (audio as? FileId) ?.fileId val audioAsFileId = (audio as? FileId) ?.fileId
@ -90,6 +93,7 @@ fun SendAudio(
title, title,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -130,6 +134,8 @@ data class SendAudioData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<AudioContent>>, ) : DataRequest<ContentMessage<AudioContent>>,

View File

@ -35,6 +35,7 @@ fun SendDocument(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
): Request<ContentMessage<DocumentContent>> { ): Request<ContentMessage<DocumentContent>> {
@ -52,6 +53,7 @@ fun SendDocument(
null, null,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup, replyMarkup,
disableContentTypeDetection disableContentTypeDetection
) )
@ -82,6 +84,7 @@ fun SendDocument(
entities: List<TextSource>, entities: List<TextSource>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
): Request<ContentMessage<DocumentContent>> { ): Request<ContentMessage<DocumentContent>> {
@ -99,6 +102,7 @@ fun SendDocument(
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup, replyMarkup,
disableContentTypeDetection disableContentTypeDetection
) )
@ -143,6 +147,8 @@ data class SendDocumentData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null, override val replyMarkup: KeyboardMarkup? = null,
@SerialName(disableContentTypeDetectionField) @SerialName(disableContentTypeDetectionField)

View File

@ -22,7 +22,8 @@ fun SendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberInputMedia>, media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
): Request<List<MediaGroupMessage>> { ): Request<List<MediaGroupMessage>> {
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)
@ -43,7 +44,8 @@ fun SendMediaGroup(
chatId, chatId,
media, media,
disableNotification, disableNotification,
replyToMessageId replyToMessageId,
allowSendingWithoutReply
) )
return if (files.isEmpty()) { return if (files.isEmpty()) {
@ -66,8 +68,9 @@ inline fun SendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberInputMedia>, media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId) allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
/** /**
* 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
@ -79,8 +82,9 @@ inline fun SendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberInputMedia>, media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId) allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
/** /**
* 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
@ -93,8 +97,9 @@ inline fun SendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberInputMedia>, media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId) allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
private val messagesListSerializer: KSerializer<List<MediaGroupMessage>> private val messagesListSerializer: KSerializer<List<MediaGroupMessage>>
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
@ -107,7 +112,9 @@ data class SendMediaGroupData internal constructor(
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null
) : DataRequest<List<MediaGroupMessage>>, SendMessageRequest<List<MediaGroupMessage>> { ) : DataRequest<List<MediaGroupMessage>>, SendMessageRequest<List<MediaGroupMessage>> {
@SerialName(mediaField) @SerialName(mediaField)
private val convertedMedia: String private val convertedMedia: String

View File

@ -24,6 +24,7 @@ fun SendPhoto(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> { ): Request<ContentMessage<PhotoContent>> {
val data = SendPhotoData( val data = SendPhotoData(
@ -34,6 +35,7 @@ fun SendPhoto(
null, null,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
return data.photo ?.let { return data.photo ?.let {
@ -50,6 +52,7 @@ fun SendPhoto(
entities: List<TextSource>, entities: List<TextSource>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> { ): Request<ContentMessage<PhotoContent>> {
val data = SendPhotoData( val data = SendPhotoData(
@ -60,6 +63,7 @@ fun SendPhoto(
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
return data.photo ?.let { return data.photo ?.let {
@ -89,6 +93,8 @@ data class SendPhotoData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<PhotoContent>>, ) : DataRequest<ContentMessage<PhotoContent>>,

View File

@ -17,12 +17,14 @@ fun SendSticker(
sticker: InputFile, sticker: InputFile,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<StickerContent>> = SendStickerByFileId( ): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
chatId, chatId,
sticker as? FileId, sticker as? FileId,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
).let { ).let {
when (sticker) { when (sticker) {
@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<StickerContent>> { ) : SendMessageRequest<ContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<StickerContent>> {

View File

@ -30,6 +30,7 @@ fun SendVideo(
supportStreaming: Boolean? = null, supportStreaming: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> { ): Request<ContentMessage<VideoContent>> {
val videoAsFileId = (video as? FileId) ?.fileId val videoAsFileId = (video as? FileId) ?.fileId
@ -50,6 +51,7 @@ fun SendVideo(
supportStreaming, supportStreaming,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -74,6 +76,7 @@ fun SendVideo(
supportStreaming: Boolean? = null, supportStreaming: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> { ): Request<ContentMessage<VideoContent>> {
val videoAsFileId = (video as? FileId) ?.fileId val videoAsFileId = (video as? FileId) ?.fileId
@ -94,6 +97,7 @@ fun SendVideo(
supportStreaming, supportStreaming,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -136,6 +140,8 @@ data class SendVideoData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VideoContent>>, ) : DataRequest<ContentMessage<VideoContent>>,

View File

@ -22,6 +22,7 @@ fun SendVideoNote(
size: Int? = null, // in documentation - length (size of video side) size: Int? = null, // in documentation - length (size of video side)
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoNoteContent>> { ): Request<ContentMessage<VideoNoteContent>> {
val videoNoteAsFileId = (videoNote as? FileId) ?.fileId val videoNoteAsFileId = (videoNote as? FileId) ?.fileId
@ -37,6 +38,7 @@ fun SendVideoNote(
size, size,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -69,6 +71,8 @@ data class SendVideoNoteData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VideoNoteContent>>, ) : DataRequest<ContentMessage<VideoNoteContent>>,

View File

@ -26,6 +26,7 @@ fun SendVoice(
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> { ): Request<ContentMessage<VoiceContent>> {
val voiceAsFileId = (voice as? FileId) ?.fileId val voiceAsFileId = (voice as? FileId) ?.fileId
@ -40,6 +41,7 @@ fun SendVoice(
duration, duration,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -60,6 +62,7 @@ fun SendVoice(
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> { ): Request<ContentMessage<VoiceContent>> {
val voiceAsFileId = (voice as? FileId) ?.fileId val voiceAsFileId = (voice as? FileId) ?.fileId
@ -74,6 +77,7 @@ fun SendVoice(
duration, duration,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -108,6 +112,8 @@ data class SendVoiceData internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VoiceContent>>, ) : DataRequest<ContentMessage<VoiceContent>>,

View File

@ -57,6 +57,8 @@ data class SendInvoice(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null override val replyMarkup: InlineKeyboardMarkup? = null
) : Currencied, ) : Currencied,

View File

@ -66,6 +66,7 @@ fun Poll.createRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = when (this) { ) = when (this) {
is RegularPoll -> SendRegularPoll( is RegularPoll -> SendRegularPoll(
@ -78,6 +79,7 @@ fun Poll.createRequest(
scheduledCloseInfo, scheduledCloseInfo,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
is QuizPoll -> correctOptionId ?.let { correctOptionId -> is QuizPoll -> correctOptionId ?.let { correctOptionId ->
@ -92,6 +94,7 @@ fun Poll.createRequest(
scheduledCloseInfo, scheduledCloseInfo,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} ?: SendRegularPoll( } ?: SendRegularPoll(
@ -104,6 +107,7 @@ fun Poll.createRequest(
scheduledCloseInfo, scheduledCloseInfo,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
is UnknownPollType -> SendRegularPoll( is UnknownPollType -> SendRegularPoll(
@ -116,6 +120,7 @@ fun Poll.createRequest(
scheduledCloseInfo, scheduledCloseInfo,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} }
@ -167,6 +172,8 @@ data class SendRegularPoll(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendPoll() { ) : SendPoll() {
@ -200,6 +207,7 @@ fun SendQuizPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll( ) = SendQuizPoll(
chatId, chatId,
@ -214,6 +222,7 @@ fun SendQuizPoll(
closeInfo, closeInfo,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -228,6 +237,7 @@ fun SendQuizPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll( ) = SendQuizPoll(
chatId, chatId,
@ -242,6 +252,7 @@ fun SendQuizPoll(
closeInfo, closeInfo,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -271,6 +282,8 @@ data class SendQuizPoll internal constructor(
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField) @SerialName(replyToMessageIdField)
override val replyToMessageId: MessageIdentifier? = null, override val replyToMessageId: MessageIdentifier? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendPoll(), ExplainedOutput { ) : SendPoll(), ExplainedOutput {

View File

@ -95,6 +95,7 @@ const val fromChatIdField = "from_chat_id"
const val disableWebPagePreviewField = "disable_web_page_preview" const val disableWebPagePreviewField = "disable_web_page_preview"
const val disableNotificationField = "disable_notification" const val disableNotificationField = "disable_notification"
const val replyToMessageIdField = "reply_to_message_id" const val replyToMessageIdField = "reply_to_message_id"
const val allowSendingWithoutReplyField = "allow_sending_without_reply"
const val replyMarkupField = "reply_markup" const val replyMarkupField = "reply_markup"
const val disableContentTypeDetectionField = "disable_content_type_detection" const val disableContentTypeDetectionField = "disable_content_type_detection"
const val supportStreamingField = "support_streaming" const val supportStreamingField = "support_streaming"