2020-02-15 09:33:04 +00:00
|
|
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.polls
|
|
|
|
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls.SendQuizPoll
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls.SendRegularPoll
|
2020-04-24 14:25:53 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
2020-04-24 13:24:49 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
2020-02-15 09:33:04 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
2020-04-24 13:24:49 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.*
|
2020-02-15 09:33:04 +00:00
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendRegularPoll(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
question: String,
|
|
|
|
options: List<String>,
|
|
|
|
isAnonymous: Boolean = true,
|
|
|
|
isClosed: Boolean = false,
|
|
|
|
allowMultipleAnswers: Boolean = false,
|
2020-04-24 13:24:49 +00:00
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = execute(
|
|
|
|
SendRegularPoll(
|
2020-04-24 13:24:49 +00:00
|
|
|
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
suspend fun RequestsExecutor.sendRegularPoll(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
poll: RegularPoll,
|
|
|
|
isClosed: Boolean = false,
|
|
|
|
question: String = poll.question,
|
|
|
|
options: List<String> = poll.options.map { it.text },
|
|
|
|
isAnonymous: Boolean = poll.isAnonymous,
|
|
|
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
2020-04-24 13:24:49 +00:00
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = execute(
|
|
|
|
SendRegularPoll(
|
2020-04-24 13:24:49 +00:00
|
|
|
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendRegularPoll(
|
|
|
|
chat: Chat,
|
|
|
|
question: String,
|
|
|
|
options: List<String>,
|
|
|
|
isAnonymous: Boolean = true,
|
|
|
|
isClosed: Boolean = false,
|
|
|
|
allowMultipleAnswers: Boolean = false,
|
2020-04-24 13:24:49 +00:00
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = sendRegularPoll(
|
2020-04-24 13:24:49 +00:00
|
|
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendRegularPoll(
|
|
|
|
chat: Chat,
|
|
|
|
poll: RegularPoll,
|
|
|
|
isClosed: Boolean = false,
|
|
|
|
question: String = poll.question,
|
|
|
|
options: List<String> = poll.options.map { it.text },
|
|
|
|
isAnonymous: Boolean = poll.isAnonymous,
|
|
|
|
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
2020-04-24 13:24:49 +00:00
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = sendRegularPoll(
|
2020-04-24 13:24:49 +00:00
|
|
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendQuizPoll(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
question: String,
|
|
|
|
options: List<String>,
|
|
|
|
correctOptionId: Int,
|
|
|
|
isAnonymous: Boolean = true,
|
|
|
|
isClosed: Boolean = false,
|
2020-04-25 03:41:04 +00:00
|
|
|
explanation: String? = null,
|
2020-04-24 13:24:49 +00:00
|
|
|
parseMode: ParseMode? = null,
|
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = execute(
|
|
|
|
SendQuizPoll(
|
2020-04-25 03:41:04 +00:00
|
|
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendQuizPoll(
|
|
|
|
chat: Chat,
|
|
|
|
question: String,
|
|
|
|
options: List<String>,
|
|
|
|
correctOptionId: Int,
|
|
|
|
isAnonymous: Boolean = true,
|
|
|
|
isClosed: Boolean = false,
|
2020-04-25 03:41:04 +00:00
|
|
|
explanation: String? = null,
|
2020-04-24 13:24:49 +00:00
|
|
|
parseMode: ParseMode? = null,
|
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = sendQuizPoll(
|
2020-04-25 03:41:04 +00:00
|
|
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendQuizPoll(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
isClosed: Boolean = false,
|
|
|
|
quizPoll: QuizPoll,
|
|
|
|
question: String = quizPoll.question,
|
|
|
|
options: List<String> = quizPoll.options.map { it.text },
|
|
|
|
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
|
|
|
|
isAnonymous: Boolean = quizPoll.isAnonymous,
|
2020-04-25 03:41:04 +00:00
|
|
|
explanation: String? = null,
|
2020-04-24 13:24:49 +00:00
|
|
|
parseMode: ParseMode? = null,
|
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = execute(
|
|
|
|
SendQuizPoll(
|
2020-04-25 03:41:04 +00:00
|
|
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
suspend fun RequestsExecutor.sendQuizPoll(
|
|
|
|
chat: Chat,
|
|
|
|
isClosed: Boolean = false,
|
|
|
|
quizPoll: QuizPoll,
|
|
|
|
question: String = quizPoll.question,
|
|
|
|
options: List<String> = quizPoll.options.map { it.text },
|
|
|
|
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
|
|
|
|
isAnonymous: Boolean = quizPoll.isAnonymous,
|
2020-04-25 03:41:04 +00:00
|
|
|
explanation: String? = null,
|
2020-04-24 13:24:49 +00:00
|
|
|
parseMode: ParseMode? = null,
|
|
|
|
closeInfo: ScheduledCloseInfo? = null,
|
2020-02-15 09:33:04 +00:00
|
|
|
disableNotification: Boolean = false,
|
|
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
|
|
replyMarkup: KeyboardMarkup? = null
|
|
|
|
) = sendQuizPoll(
|
2020-04-25 03:41:04 +00:00
|
|
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|