1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +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 {
val replyToMessageId: MessageIdentifier?
val allowSendingWithoutReply: Boolean?
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,8 @@ fun SendMediaGroup(
chatId: ChatIdentifier,
media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
): Request<List<MediaGroupMessage>> {
if (media.size !in mediaCountInMediaGroup) {
throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size)
@ -43,7 +44,8 @@ fun SendMediaGroup(
chatId,
media,
disableNotification,
replyToMessageId
replyToMessageId,
allowSendingWithoutReply
)
return if (files.isEmpty()) {
@ -66,8 +68,9 @@ inline fun SendPlaylist(
chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId)
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
/**
* Use this method to be sure that you are correctly sending documents media group
@ -79,8 +82,9 @@ inline fun SendDocumentsGroup(
chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId)
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
/**
* Use this method to be sure that you are correctly sending visual media group
@ -93,8 +97,9 @@ inline fun SendVisualMediaGroup(
chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId)
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply)
private val messagesListSerializer: KSerializer<List<MediaGroupMessage>>
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
@ -107,7 +112,9 @@ data class SendMediaGroupData internal constructor(
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@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>> {
@SerialName(mediaField)
private val convertedMedia: String

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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