From aa9ca976f02a3e748407da8c21502f5838df0a77 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 10 May 2024 16:45:47 +0600 Subject: [PATCH] update polls to include showing of polls question and explanation text sources passing --- PollsBot/src/main/kotlin/PollsBot.kt | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/PollsBot/src/main/kotlin/PollsBot.kt b/PollsBot/src/main/kotlin/PollsBot.kt index 03f1776..e7f885c 100644 --- a/PollsBot/src/main/kotlin/PollsBot.kt +++ b/PollsBot/src/main/kotlin/PollsBot.kt @@ -67,7 +67,12 @@ suspend fun main(vararg args: String) { ?.firstNotNullOfOrNull { it.customEmojiTextSourceOrNull() } val sentPoll = sendRegularPoll( it.chat.id, - "Test regular anonymous poll", + buildEntities { + regular("Test regular anonymous poll") + if (customEmoji != null) { + customEmoji(customEmoji.customEmojiId, customEmoji.subsources) + } + }, (1 .. 10).map { InputPollOption { regular(it.toString()) + " " @@ -92,7 +97,12 @@ suspend fun main(vararg args: String) { ?.firstNotNullOfOrNull { it.customEmojiTextSourceOrNull() } val sentPoll = sendRegularPoll( it.chat.id, - "Test regular non anonymous poll", + buildEntities { + regular("Test regular non anonymous poll") + if (customEmoji != null) { + customEmoji(customEmoji.customEmojiId, customEmoji.subsources) + } + }, (1 .. 10).map { InputPollOption { regular(it.toString()) + " " @@ -118,7 +128,12 @@ suspend fun main(vararg args: String) { val correctAnswer = Random.nextInt(10) val sentPoll = sendQuizPoll( it.chat.id, - "Test quiz poll", + questionEntities = buildEntities { + regular("Test quiz poll") + if (customEmoji != null) { + customEmoji(customEmoji.customEmojiId, customEmoji.subsources) + } + }, (1 .. 10).map { InputPollOption { regular(it.toString()) + " " @@ -131,7 +146,10 @@ suspend fun main(vararg args: String) { replyParameters = ReplyParameters(it), correctOptionId = correctAnswer, explanationTextSources = buildEntities { - regular("Random solved it to be ") + underline((correctAnswer + 1).toString()) + regular("Random solved it to be ") + underline((correctAnswer + 1).toString()) + " " + if (customEmoji != null) { + customEmoji(customEmoji.customEmojiId, customEmoji.subsources) + } } ) pollToChatMutex.withLock {