mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 12:08:43 +00:00
fix in createRequest for Poll
This commit is contained in:
parent
f4a731940e
commit
b9e674821b
@ -49,6 +49,10 @@ fun SendPoll(
|
|||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return [SendPoll] in case when all is right. It can return [SendRegularPoll] for [QuizPoll] in case if
|
||||||
|
* [QuizPoll.correctOptionId] equal to null
|
||||||
|
*/
|
||||||
fun Poll.createRequest(
|
fun Poll.createRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@ -66,7 +70,8 @@ fun Poll.createRequest(
|
|||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
is QuizPoll -> SendQuizPoll(
|
is QuizPoll -> correctOptionId ?.let { correctOptionId ->
|
||||||
|
SendQuizPoll(
|
||||||
chatId,
|
chatId,
|
||||||
question,
|
question,
|
||||||
options.map { it.text },
|
options.map { it.text },
|
||||||
@ -77,6 +82,17 @@ fun Poll.createRequest(
|
|||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
} ?: SendRegularPoll(
|
||||||
|
chatId,
|
||||||
|
question,
|
||||||
|
options.map { it.text },
|
||||||
|
isAnonymous,
|
||||||
|
isClosed,
|
||||||
|
false,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
is UnknownPollType -> SendRegularPoll(
|
is UnknownPollType -> SendRegularPoll(
|
||||||
chatId,
|
chatId,
|
||||||
question,
|
question,
|
||||||
|
Loading…
Reference in New Issue
Block a user