1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-04-17 23:42:26 +00:00

fix name of allowMultipleAnswers to allowsMultipleAnswers

This commit is contained in:
2026-04-16 13:02:10 +06:00
parent 4a0b890697
commit 83de9fd973
11 changed files with 223 additions and 204 deletions

View File

@@ -8048,13 +8048,19 @@ public final class dev/inmo/tgbotapi/requests/send/payments/SendInvoice$Companio
public abstract class dev/inmo/tgbotapi/requests/send/polls/SendPoll : dev/inmo/tgbotapi/abstracts/TextedInput, dev/inmo/tgbotapi/requests/send/abstracts/ReplyingMarkupSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/SendContentMessageRequest {
public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean;
public abstract fun getAllowsMultipleAnswers ()Z
public abstract fun getAllowsRevoting ()Z
public fun getCloseInfo ()Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;
protected final fun getCreationDate-Wg0KzQs ()D
public abstract fun getDescription ()Ljava/lang/String;
public abstract fun getDescriptionTextSources ()Ljava/util/List;
public abstract fun getHideResultsUntilCloses ()Z
public abstract fun getOptions ()Ljava/util/List;
public abstract fun getQuestion ()Ljava/lang/String;
public abstract fun getQuestionParseMode ()Ldev/inmo/tgbotapi/types/message/ParseMode;
public fun getReplyToMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId;
public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy;
public abstract fun getShuffleOptions ()Z
public fun getText ()Ljava/lang/String;
public abstract fun getType ()Ljava/lang/String;
public abstract fun isAnonymous ()Z
@@ -8082,22 +8088,22 @@ public final class dev/inmo/tgbotapi/requests/send/polls/SendQuizPoll : dev/inmo
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZZZZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/Long;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;ZZZZZZLjava/util/List;Ljava/lang/Long;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;ZZZZZZLjava/util/List;Ljava/lang/Long;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getAllowMultipleAnswers ()Z
public fun getAllowPaidBroadcast ()Z
public final fun getAllowsRevoting ()Z
public fun getAllowsMultipleAnswers ()Z
public fun getAllowsRevoting ()Z
public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier;
public final fun getCorrectOptionIds ()Ljava/util/List;
public final fun getDescription ()Ljava/lang/String;
public fun getDescription ()Ljava/lang/String;
public final fun getDescriptionParseMode ()Ldev/inmo/tgbotapi/types/message/ParseMode;
public final fun getDescriptionTextSources ()Ljava/util/List;
public fun getDescriptionTextSources ()Ljava/util/List;
public fun getDirectMessageThreadId-1osv_qQ ()Ldev/inmo/tgbotapi/types/DirectMessageThreadId;
public fun getDisableNotification ()Z
public fun getEffectId-Ts0V7ak ()Ljava/lang/String;
public final fun getExplanation ()Ljava/lang/String;
public final fun getExplanationParseMode ()Ldev/inmo/tgbotapi/types/message/ParseMode;
public final fun getExplanationTextEntities ()Ljava/util/List;
public final fun getHideResultsUntilCloses ()Z
public fun getHideResultsUntilCloses ()Z
public fun getOptions ()Ljava/util/List;
public fun getProtectContent ()Z
public fun getQuestion ()Ljava/lang/String;
@@ -8105,7 +8111,7 @@ public final class dev/inmo/tgbotapi/requests/send/polls/SendQuizPoll : dev/inmo
public fun getReplyMarkup ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;
public fun getReplyParameters ()Ldev/inmo/tgbotapi/types/ReplyParameters;
public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy;
public final fun getShuffleOptions ()Z
public fun getShuffleOptions ()Z
public fun getSuggestedPostParameters ()Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;
public fun getTextSources ()Ljava/util/List;
public fun getThreadId-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId;
@@ -8153,18 +8159,18 @@ public final class dev/inmo/tgbotapi/requests/send/polls/SendRegularPoll : dev/i
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;ZZZZZZZLjava/util/List;Ljava/lang/Long;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun <init> (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ljava/util/List;ZZZZZZZLjava/util/List;Ljava/lang/Long;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ldev/inmo/tgbotapi/types/DirectMessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getAllowAddingOptions ()Z
public final fun getAllowMultipleAnswers ()Z
public fun getAllowPaidBroadcast ()Z
public final fun getAllowsRevoting ()Z
public fun getAllowsMultipleAnswers ()Z
public fun getAllowsRevoting ()Z
public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier;
public final fun getDescription ()Ljava/lang/String;
public fun getDescription ()Ljava/lang/String;
public final fun getDescriptionParseMode ()Ldev/inmo/tgbotapi/types/message/ParseMode;
public final fun getDescriptionTextSources ()Ljava/util/List;
public fun getDescriptionTextSources ()Ljava/util/List;
public fun getDirectMessageThreadId-1osv_qQ ()Ldev/inmo/tgbotapi/types/DirectMessageThreadId;
public fun getDisableNotification ()Z
public fun getEffectId-Ts0V7ak ()Ljava/lang/String;
public final fun getHideResultsUntilCloses ()Z
public fun getHideResultsUntilCloses ()Z
public fun getOptions ()Ljava/util/List;
public fun getProtectContent ()Z
public fun getQuestion ()Ljava/lang/String;
@@ -8172,7 +8178,7 @@ public final class dev/inmo/tgbotapi/requests/send/polls/SendRegularPoll : dev/i
public fun getReplyMarkup ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;
public fun getReplyParameters ()Ldev/inmo/tgbotapi/types/ReplyParameters;
public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy;
public final fun getShuffleOptions ()Z
public fun getShuffleOptions ()Z
public fun getSuggestedPostParameters ()Ldev/inmo/tgbotapi/types/message/SuggestedPostParameters;
public fun getTextSources ()Ljava/util/List;
public fun getThreadId-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId;
@@ -31765,7 +31771,7 @@ public final class dev/inmo/tgbotapi/types/polls/InputPollOption$Companion : kot
public abstract interface class dev/inmo/tgbotapi/types/polls/Poll : dev/inmo/tgbotapi/abstracts/TextedInput, dev/inmo/tgbotapi/types/ReplyInfo$External$ContentVariant {
public static final field Companion Ldev/inmo/tgbotapi/types/polls/Poll$Companion;
public abstract fun getAllowMultipleAnswers ()Z
public abstract fun getAllowsMultipleAnswers ()Z
public abstract fun getAllowsRevoting ()Z
public abstract fun getDescriptionTextSources ()Ljava/util/List;
public abstract fun getId-S5FO_mE ()Ljava/lang/String;
@@ -32122,7 +32128,7 @@ public final class dev/inmo/tgbotapi/types/polls/QuizPoll : dev/inmo/tgbotapi/ty
public final fun copy-YPAypuI (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;ILjava/util/List;Ljava/lang/String;Ljava/util/List;ZZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/QuizPoll;
public static synthetic fun copy-YPAypuI$default (Ldev/inmo/tgbotapi/types/polls/QuizPoll;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;ILjava/util/List;Ljava/lang/String;Ljava/util/List;ZZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/QuizPoll;
public fun equals (Ljava/lang/Object;)Z
public fun getAllowMultipleAnswers ()Z
public fun getAllowsMultipleAnswers ()Z
public fun getAllowsRevoting ()Z
public final fun getCorrectOptionIds ()Ljava/util/List;
public fun getDescriptionTextSources ()Ljava/util/List;
@@ -32164,7 +32170,7 @@ public final class dev/inmo/tgbotapi/types/polls/RegularPoll : dev/inmo/tgbotapi
public final fun copy-dx2gcjE (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;IZZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/RegularPoll;
public static synthetic fun copy-dx2gcjE$default (Ldev/inmo/tgbotapi/types/polls/RegularPoll;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;IZZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/RegularPoll;
public fun equals (Ljava/lang/Object;)Z
public fun getAllowMultipleAnswers ()Z
public fun getAllowsMultipleAnswers ()Z
public fun getAllowsRevoting ()Z
public fun getDescriptionTextSources ()Ljava/util/List;
public fun getId-S5FO_mE ()Ljava/lang/String;
@@ -32204,7 +32210,7 @@ public final class dev/inmo/tgbotapi/types/polls/UnknownPollType : dev/inmo/tgbo
public final fun component8 ()Z
public final fun component9 ()Z
public fun equals (Ljava/lang/Object;)Z
public fun getAllowMultipleAnswers ()Z
public fun getAllowsMultipleAnswers ()Z
public fun getAllowsRevoting ()Z
public fun getDescriptionTextSources ()Ljava/util/List;
public fun getId-S5FO_mE ()Ljava/lang/String;

View File

@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.requests.send.polls
import dev.inmo.kslog.common.w
import dev.inmo.tgbotapi.abstracts.TextedInput
import korlibs.time.DateTime
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
@@ -31,15 +32,21 @@ internal fun checkPollInfo(
options: List<InputPollOption>
) {
if (question.length !in pollQuestionTextLength) {
throw IllegalArgumentException("The length of questions for polls must be in $pollQuestionTextLength range, but was ${question.length}")
DefaultKTgBotAPIKSLog.w("checkPollInfo") {
"The length of questions for polls must be in $pollQuestionTextLength range, but was ${question.length}"
}
}
options.forEach {
if (it.text.length !in pollOptionTextLength) {
throw IllegalArgumentException("The length of question option text for polls must be in $pollOptionTextLength range, but was ${it.text.length}")
DefaultKTgBotAPIKSLog.w("checkPollInfo") {
"The length of question option text for polls must be in $pollOptionTextLength range, but was ${it.text.length}"
}
}
}
if (options.size !in pollOptionsLimit) {
throw IllegalArgumentException("The amount of question options for polls must be in $pollOptionsLimit range, but was ${options.size}")
DefaultKTgBotAPIKSLog.w("checkPollInfo") {
"The amount of question options for polls must be in $pollOptionsLimit range, but was ${options.size}"
}
}
}
@@ -75,7 +82,7 @@ fun SendPoll(
questionParseMode = questionParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = false,
allowsMultipleAnswers = false,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -123,7 +130,7 @@ fun SendPoll(
closeInfo = openPeriod?.asApproximateScheduledCloseInfo ?: closeDate?.asExactScheduledCloseInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = false,
allowsMultipleAnswers = false,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -166,7 +173,7 @@ fun Poll.createRequest(
closeInfo = scheduledCloseInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
@@ -206,7 +213,7 @@ fun Poll.createRequest(
closeInfo = scheduledCloseInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = false,
allowsMultipleAnswers = false,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
@@ -225,7 +232,7 @@ fun Poll.createRequest(
closeInfo = scheduledCloseInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = false,
allowsMultipleAnswers = false,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
@@ -261,6 +268,12 @@ sealed class SendPoll : SendContentMessageRequest<ContentMessage<PollContent>>,
abstract val isAnonymous: Boolean
abstract val isClosed: Boolean
abstract val type: String
abstract val allowsMultipleAnswers: Boolean
abstract val allowsRevoting: Boolean
abstract val shuffleOptions: Boolean
abstract val description: String?
abstract val hideResultsUntilCloses: Boolean
abstract val descriptionTextSources: TextSourcesList?
internal abstract val openPeriod: LongSeconds?
internal abstract val closeDate: LongSeconds?

View File

@@ -42,13 +42,13 @@ class SendQuizPoll internal constructor(
@SerialName(isClosedField)
override val isClosed: Boolean = false,
@SerialName(allowsMultipleAnswersField)
val allowMultipleAnswers: Boolean = false,
override val allowsMultipleAnswers: Boolean = false,
@SerialName(allowsRevotingField)
val allowsRevoting: Boolean = false,
override val allowsRevoting: Boolean = false,
@SerialName(shuffleOptionsField)
val shuffleOptions: Boolean = false,
override val shuffleOptions: Boolean = false,
@SerialName(hideResultsUntilClosesField)
val hideResultsUntilCloses: Boolean = false,
override val hideResultsUntilCloses: Boolean = false,
@SerialName(explanationField)
val explanation: String? = null,
@SerialName(explanationParseModeField)
@@ -56,7 +56,7 @@ class SendQuizPoll internal constructor(
@SerialName(explanationEntitiesField)
private val rawExplanationEntities: List<RawMessageEntity>? = null,
@SerialName(descriptionField)
val description: String? = null,
override val description: String? = null,
@SerialName(descriptionParseModeField)
val descriptionParseMode: ParseMode? = null,
@SerialName(descriptionEntitiesField)
@@ -98,7 +98,7 @@ class SendQuizPoll internal constructor(
val explanationTextEntities: List<TextSource>? by lazy {
rawExplanationEntities?.asTextSources(text ?: return@lazy null)
}
val descriptionTextSources: List<TextSource>? by lazy {
override val descriptionTextSources: List<TextSource>? by lazy {
rawDescriptionEntities?.asTextSources(description ?: return@lazy null)
}
@@ -112,7 +112,7 @@ class SendQuizPoll internal constructor(
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -139,7 +139,7 @@ class SendQuizPoll internal constructor(
rawQuestionEntities = emptyList(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -172,7 +172,7 @@ class SendQuizPoll internal constructor(
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -199,7 +199,7 @@ class SendQuizPoll internal constructor(
rawQuestionEntities = questionEntities.toRawMessageEntities(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -232,7 +232,7 @@ class SendQuizPoll internal constructor(
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -258,7 +258,7 @@ class SendQuizPoll internal constructor(
rawQuestionEntities = emptyList(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -290,7 +290,7 @@ class SendQuizPoll internal constructor(
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -316,7 +316,7 @@ class SendQuizPoll internal constructor(
rawQuestionEntities = questionEntities.toRawMessageEntities(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -354,7 +354,7 @@ class SendQuizPoll internal constructor(
DefaultKTgBotAPIKSLog.w("SendQuizPoll", "Quiz poll explanation size must be in range $explanationLimit," +
"but actual explanation contains ${text.length} symbols")
}
if (allowMultipleAnswers == false && correctOptionIds.size > 1) {
if (allowsMultipleAnswers == false && correctOptionIds.size > 1) {
DefaultKTgBotAPIKSLog.w("SendQuizPoll", "Multiple answers are disabled for current sendQuizPoll, but multiple correct options passed")
}
}
@@ -371,7 +371,7 @@ fun SendQuizPoll(
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -397,7 +397,7 @@ fun SendQuizPoll(
explanationParseMode = explanationParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -427,7 +427,7 @@ fun SendQuizPoll(
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -452,7 +452,7 @@ fun SendQuizPoll(
explanationParseMode = explanationParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -482,7 +482,7 @@ fun SendQuizPoll(
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -506,7 +506,7 @@ fun SendQuizPoll(
explanationTextSources = explanationTextSources,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,
@@ -534,7 +534,7 @@ fun SendQuizPoll(
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = false,
shuffleOptions: Boolean = false,
hideResultsUntilCloses: Boolean = false,
@@ -557,7 +557,7 @@ fun SendQuizPoll(
explanationTextSources = explanationTextSources,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
hideResultsUntilCloses = hideResultsUntilCloses,

View File

@@ -41,17 +41,17 @@ class SendRegularPoll constructor(
@SerialName(isClosedField)
override val isClosed: Boolean = false,
@SerialName(allowsMultipleAnswersField)
val allowMultipleAnswers: Boolean = false,
override val allowsMultipleAnswers: Boolean = false,
@SerialName(allowsRevotingField)
val allowsRevoting: Boolean = true,
override val allowsRevoting: Boolean = true,
@SerialName(shuffleOptionsField)
val shuffleOptions: Boolean = false,
override val shuffleOptions: Boolean = false,
@SerialName(allowAddingOptionsField)
val allowAddingOptions: Boolean = false,
@SerialName(hideResultsUntilClosesField)
val hideResultsUntilCloses: Boolean = false,
override val hideResultsUntilCloses: Boolean = false,
@SerialName(descriptionField)
val description: String? = null,
override val description: String? = null,
@SerialName(descriptionParseModeField)
val descriptionParseMode: ParseMode? = null,
@SerialName(descriptionEntitiesField)
@@ -87,7 +87,7 @@ class SendRegularPoll constructor(
) : SendPoll() {
override val textSources: List<TextSource>
get() = rawQuestionEntities.asTextSources(text)
val descriptionTextSources: List<TextSource>? by lazy {
override val descriptionTextSources: List<TextSource>? by lazy {
rawDescriptionEntities?.asTextSources(description ?: return@lazy null)
}
@@ -97,7 +97,7 @@ class SendRegularPoll constructor(
options: List<InputPollOption>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -124,7 +124,7 @@ class SendRegularPoll constructor(
rawQuestionEntities = questionEntities.toRawMessageEntities(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -153,7 +153,7 @@ class SendRegularPoll constructor(
questionParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -180,7 +180,7 @@ class SendRegularPoll constructor(
rawQuestionEntities = emptyList(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -209,7 +209,7 @@ class SendRegularPoll constructor(
questionParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -235,7 +235,7 @@ class SendRegularPoll constructor(
rawQuestionEntities = emptyList(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -263,7 +263,7 @@ class SendRegularPoll constructor(
options: List<InputPollOption>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -289,7 +289,7 @@ class SendRegularPoll constructor(
rawQuestionEntities = questionEntities.toRawMessageEntities(),
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -333,7 +333,7 @@ fun SendRegularPoll(
questionParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -357,7 +357,7 @@ fun SendRegularPoll(
questionParseMode = questionParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -385,7 +385,7 @@ fun SendRegularPoll(
closeInfo: ScheduledCloseInfo?,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -408,7 +408,7 @@ fun SendRegularPoll(
options = options,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -435,7 +435,7 @@ fun SendRegularPoll(
closeInfo: ScheduledCloseInfo?,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
allowsMultipleAnswers: Boolean = false,
allowsRevoting: Boolean = true,
shuffleOptions: Boolean = false,
allowAddingOptions: Boolean = false,
@@ -460,7 +460,7 @@ fun SendRegularPoll(
closeInfo = closeInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
allowsMultipleAnswers = allowsMultipleAnswers,
allowsRevoting = allowsRevoting,
shuffleOptions = shuffleOptions,
allowAddingOptions = allowAddingOptions,
@@ -477,4 +477,4 @@ fun SendRegularPoll(
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

View File

@@ -63,7 +63,7 @@ sealed interface Poll : ReplyInfo.External.ContentVariant, TextedInput {
val votesCount: Int
val isClosed: Boolean
val isAnonymous: Boolean
val allowMultipleAnswers: Boolean
val allowsMultipleAnswers: Boolean
val allowsRevoting: Boolean
val scheduledCloseInfo: ScheduledCloseInfo?
val descriptionTextSources: List<TextSource>
@@ -88,7 +88,7 @@ private class RawPoll(
@SerialName(typeField)
val type: String,
@SerialName(allowsMultipleAnswersField)
val allowMultipleAnswers: Boolean = false,
val allowsMultipleAnswers: Boolean = false,
@SerialName(correctOptionIdsField)
val correctOptionIds: List<Int>? = null,
@SerialName(explanationField)
@@ -128,7 +128,7 @@ data class UnknownPollType internal constructor(
override val isClosed: Boolean = false,
@SerialName(isAnonymousField)
override val isAnonymous: Boolean = false,
override val allowMultipleAnswers: Boolean = false,
override val allowsMultipleAnswers: Boolean = false,
override val allowsRevoting: Boolean = true,
override val descriptionTextSources: List<TextSource> = emptyList(),
@Serializable
@@ -152,7 +152,7 @@ data class RegularPoll(
override val votesCount: Int,
override val isClosed: Boolean = false,
override val isAnonymous: Boolean = false,
override val allowMultipleAnswers: Boolean = false,
override val allowsMultipleAnswers: Boolean = false,
override val allowsRevoting: Boolean = true,
override val scheduledCloseInfo: ScheduledCloseInfo? = null,
override val descriptionTextSources: List<TextSource> = emptyList()
@@ -170,7 +170,7 @@ data class QuizPoll(
val explanationTextSources: List<TextSource> = emptyList(),
override val isClosed: Boolean = false,
override val isAnonymous: Boolean = false,
override val allowMultipleAnswers: Boolean = false,
override val allowsMultipleAnswers: Boolean = false,
override val allowsRevoting: Boolean = false,
override val scheduledCloseInfo: ScheduledCloseInfo? = null,
override val descriptionTextSources: List<TextSource> = emptyList()
@@ -196,7 +196,7 @@ object PollSerializer : KSerializer<Poll> {
explanationTextSources = rawPoll.explanation?.let { rawPoll.explanationEntities.asTextSources(it) } ?: emptyList(),
isClosed = rawPoll.isClosed,
isAnonymous = rawPoll.isAnonymous,
allowMultipleAnswers = rawPoll.allowMultipleAnswers,
allowsMultipleAnswers = rawPoll.allowsMultipleAnswers,
allowsRevoting = rawPoll.allowsRevoting ?: false,
scheduledCloseInfo = rawPoll.scheduledCloseInfo,
descriptionTextSources = rawPoll.description?.let { rawPoll.descriptionEntities.asTextSources(it) } ?: emptyList()
@@ -209,7 +209,7 @@ object PollSerializer : KSerializer<Poll> {
votesCount = rawPoll.votesCount,
isClosed = rawPoll.isClosed,
isAnonymous = rawPoll.isAnonymous,
allowMultipleAnswers = rawPoll.allowMultipleAnswers,
allowsMultipleAnswers = rawPoll.allowsMultipleAnswers,
allowsRevoting = rawPoll.allowsRevoting ?: true,
scheduledCloseInfo = rawPoll.scheduledCloseInfo,
descriptionTextSources = rawPoll.description?.let { rawPoll.descriptionEntities.asTextSources(it) } ?: emptyList()
@@ -239,7 +239,7 @@ object PollSerializer : KSerializer<Poll> {
isClosed = value.isClosed,
isAnonymous = value.isAnonymous,
type = regularPollType,
allowMultipleAnswers = value.allowMultipleAnswers,
allowsMultipleAnswers = value.allowsMultipleAnswers,
allowsRevoting = value.allowsRevoting,
description = value.descriptionTextSources.makeSourceString().takeIf { it.isNotEmpty() },
descriptionEntities = value.descriptionTextSources.toRawMessageEntities(),
@@ -255,7 +255,7 @@ object PollSerializer : KSerializer<Poll> {
isClosed = value.isClosed,
isAnonymous = value.isAnonymous,
type = quizPollType,
allowMultipleAnswers = value.allowMultipleAnswers,
allowsMultipleAnswers = value.allowsMultipleAnswers,
correctOptionIds = value.correctOptionIds,
allowsRevoting = value.allowsRevoting,
explanation = value.explanation,