From 9747c8bff129fe0865375f42169e2487e544400f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 9 May 2020 21:04:56 +0600 Subject: [PATCH] warnings fixes --- .../TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt | 3 +++ .../TelegramBotAPI/requests/send/polls/SendPoll.kt | 2 +- .../insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt | 4 ++-- .../github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt | 1 + .../insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt | 6 ------ 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt index 5deeb7fcb4..6a078b810a 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt @@ -68,7 +68,9 @@ fun RequestsExecutor.startGettingOfUpdates( * [kotlinx.coroutines.flow.Flow.collect] on one of [FlowsUpdatesFilter] flows. To avoid it, you can pass * [flowUpdatesPreset] lambda - it will be called BEFORE starting updates getting */ +@FlowPreview @PreviewFeature +@Suppress("unused") fun RequestsExecutor.startGettingFlowsUpdates( timeoutSeconds: Seconds = 30, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), @@ -137,6 +139,7 @@ fun RequestsExecutor.startGettingOfUpdates( ) } +@Suppress("unused") fun RequestsExecutor.startGettingOfUpdates( messageCallback: UpdateReceiver? = null, mediaGroupCallback: UpdateReceiver? = null, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt index a87e377025..662d1c69e4 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt @@ -85,7 +85,7 @@ fun Poll.createRequest( correctOptionId, isAnonymous, isClosed, - caption ?.fullListOfSubSource(captionEntities) ?.justTextSources() ?.toMarkdownV2Captions() ?.firstOrNull(), + explanation ?.fullListOfSubSource(explanationEntities) ?.justTextSources() ?.toMarkdownV2Captions() ?.firstOrNull(), MarkdownV2, scheduledCloseInfo, disableNotification, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt index e926c18890..8b1f45bd55 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt @@ -212,8 +212,8 @@ internal object PollSerializer : KSerializer { value.isAnonymous, regularPollType, correctOptionId = value.correctOptionId, - explanation = value.caption, - explanationEntities = value.captionEntities.asRawMessageEntities(), + explanation = value.explanation, + explanationEntities = value.explanationEntities.asRawMessageEntities(), openPeriod = (closeInfo as? ApproximateScheduledCloseInfo) ?.openDuration ?.seconds ?.toLong(), closeDate = (closeInfo as? ExactScheduledCloseInfo) ?.closeDateTime ?.unixMillisLong ?.div(1000L) ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt index 89aca12d12..1c26099558 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt @@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.json.* +@Suppress("EXPERIMENTAL_API_USAGE") internal val nonstrictJsonFormat = Json { isLenient = true ignoreUnknownKeys = true diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt index 50219dd4c5..57d6f8185c 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt @@ -4,9 +4,3 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonConfiguration val TestsJsonFormat = Json(JsonConfiguration.Stable) -val NonstrictTestsJsonFormat = Json { - isLenient = true - ignoreUnknownKeys = true - serializeSpecialFloatingPointValues = true - useArrayPolymorphism = true -}