From 4085913bc3cb37a22c3204f0b7d6fa4e77c55b9c Mon Sep 17 00:00:00 2001 From: bpavuk Date: Sun, 14 Jul 2024 15:33:24 +0300 Subject: [PATCH] =?UTF-8?q?moving=20to=20an=20explicit=20API=20mode=20refa?= =?UTF-8?q?ctored=20the=20rest=20=F0=9F=8C=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tgbotapi/extensions/api/BotBuilder.kt | 6 ++-- .../tgbotapi/extensions/api/BotExtensions.kt | 28 ++++++++-------- .../dev/inmo/tgbotapi/extensions/api/Close.kt | 2 +- .../tgbotapi/extensions/api/DeleteMessage.kt | 26 +++++++-------- .../tgbotapi/extensions/api/DeleteMessages.kt | 32 +++++++++---------- .../tgbotapi/extensions/api/ForwardMessage.kt | 25 ++++++++------- .../extensions/api/ForwardMessages.kt | 32 +++++++++---------- .../tgbotapi/extensions/api/GetUpdates.kt | 8 ++--- .../tgbotapi/extensions/api/GetUpdatesRaw.kt | 9 +++--- .../extensions/api/LiveFlowLocation.kt | 19 +++++++---- .../extensions/api/LiveLocationProvider.kt | 32 +++++++++---------- .../inmo/tgbotapi/extensions/api/LogOut.kt | 2 +- .../inmo/tgbotapi/extensions/api/StopPoll.kt | 17 +++++----- .../api/stickers/AddStickerToSet.kt | 32 +++++++++---------- .../api/stickers/CreateNewStickerSet.kt | 8 ++--- .../api/stickers/DeleteStickerFromSet.kt | 8 ++--- .../api/stickers/DeleteStickerSet.kt | 12 +++---- .../api/stickers/ReplaceStickerInSet.kt | 32 +++++++++---------- .../stickers/SetCustomEmojiStickerSetThumb.kt | 8 ++--- .../api/stickers/SetStickerEmojiList.kt | 8 ++--- .../api/stickers/SetStickerKeywords.kt | 8 ++--- .../api/stickers/SetStickerMaskPosition.kt | 4 +-- .../api/stickers/SetStickerPositionInSet.kt | 8 ++--- .../api/stickers/SetStickerSetThumbnail.kt | 32 +++++++++---------- .../api/stickers/SetStickerSetTitle.kt | 12 +++---- .../api/stickers/UploadStickerFile.kt | 9 +++--- .../extensions/api/utils/UpdatesHandling.kt | 2 +- .../extensions/api/webhook/DeleteWebhook.kt | 2 +- .../extensions/api/webhook/GetWebhookInfo.kt | 3 +- .../extensions/api/webhook/SetWebhookInfo.kt | 12 +++---- 30 files changed, 224 insertions(+), 214 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt index b83b9a9f01..11a7fc8647 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt @@ -12,7 +12,7 @@ import io.ktor.client.engine.* * @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO] * @param ktorClientConfig Config block for preconfiguring of bot [HttpClient] */ -data class BotBuilder internal constructor( +public data class BotBuilder internal constructor( var proxy: ProxyConfig? = null, var ktorClientEngineFactory: HttpClientEngineFactory? = null, var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null @@ -37,12 +37,12 @@ data class BotBuilder internal constructor( * @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and * [block] */ -fun buildBot( +public fun buildBot( token: String, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, block: BotBuilder.() -> Unit -) = telegramBot( +): TelegramBot = telegramBot( TelegramAPIUrlsKeeper(token, testServer, apiUrl), BotBuilder().apply(block).createHttpClient() ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt index afb5ac8a2a..b53706d43b 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt @@ -11,7 +11,7 @@ import io.ktor.client.engine.* /** * Allows to create bot using bot [urlsKeeper] and already prepared [client] */ -fun telegramBot( +public fun telegramBot( urlsKeeper: TelegramAPIUrlsKeeper, client: HttpClient = HttpClient() ): TelegramBot = telegramBot(urlsKeeper) { @@ -23,11 +23,11 @@ fun telegramBot( * configure it with [clientConfig] */ @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( urlsKeeper: TelegramAPIUrlsKeeper, clientFactory: HttpClientEngineFactory, noinline clientConfig: HttpClientConfig.() -> Unit = {} -) = telegramBot( +): TelegramBot = telegramBot( urlsKeeper, HttpClient(clientFactory, clientConfig) ) @@ -37,11 +37,11 @@ inline fun telegramBot( * configure [HttpClient] using [clientConfig] */ @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( urlsKeeper: TelegramAPIUrlsKeeper, clientEngine: HttpClientEngine, noinline clientConfig: HttpClientConfig<*>.() -> Unit = {} -) = telegramBot( +): TelegramBot = telegramBot( urlsKeeper, HttpClient(clientEngine, clientConfig) ) @@ -51,10 +51,10 @@ inline fun telegramBot( * [clientConfig] */ @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( urlsKeeper: TelegramAPIUrlsKeeper, noinline clientConfig: HttpClientConfig<*>.() -> Unit -) = telegramBot( +): TelegramBot = telegramBot( urlsKeeper, HttpClient(clientConfig) ) @@ -63,7 +63,7 @@ inline fun telegramBot( * Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client] */ @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( token: String, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, @@ -71,13 +71,13 @@ inline fun telegramBot( ): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client) @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( token: String, clientFactory: HttpClientEngineFactory, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, noinline clientConfig: HttpClientConfig.() -> Unit = {} -) = telegramBot( +): TelegramBot = telegramBot( TelegramAPIUrlsKeeper(token, testServer, apiUrl), clientFactory, clientConfig @@ -88,13 +88,13 @@ inline fun telegramBot( * configure [HttpClient] using [clientConfig] */ @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( token: String, clientEngine: HttpClientEngine, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, noinline clientConfig: HttpClientConfig<*>.() -> Unit = {} -) = telegramBot( +): TelegramBot = telegramBot( TelegramAPIUrlsKeeper(token, testServer, apiUrl), clientEngine, clientConfig @@ -105,12 +105,12 @@ inline fun telegramBot( * [clientConfig] */ @Suppress("NOTHING_TO_INLINE") -inline fun telegramBot( +public inline fun telegramBot( token: String, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, noinline clientConfig: HttpClientConfig<*>.() -> Unit -) = telegramBot( +): TelegramBot = telegramBot( TelegramAPIUrlsKeeper(token, testServer, apiUrl), clientConfig ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt index 14a613d890..53f29d2f4a 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt @@ -4,4 +4,4 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.local.Close @Suppress("unused") -suspend inline fun TelegramBot.close() = execute(Close) +public suspend inline fun TelegramBot.close(): Boolean = execute(Close) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt index ab2c648790..b74d92e822 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt @@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent -suspend fun TelegramBot.deleteMessage( +public suspend fun TelegramBot.deleteMessage( chatId: ChatIdentifier, messageId: MessageId -) = execute( +): Boolean = execute( DeleteMessage(chatId, messageId) ) -suspend fun TelegramBot.deleteMessage( +public suspend fun TelegramBot.deleteMessage( chat: Chat, messageId: MessageId -) = deleteMessage(chat.id, messageId) +): Boolean = deleteMessage(chat.id, messageId) -suspend fun TelegramBot.deleteMessage( +public suspend fun TelegramBot.deleteMessage( message: AccessibleMessage ): Boolean { val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>) @@ -34,20 +34,20 @@ suspend fun TelegramBot.deleteMessage( } } -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( chatId: ChatIdentifier, messageId: MessageId -) = deleteMessage(chatId, messageId) +): Boolean = deleteMessage(chatId, messageId) -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( chat: Chat, messageId: MessageId -) = deleteMessage(chat, messageId) +): Boolean = deleteMessage(chat, messageId) -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( message: AccessibleMessage -) = deleteMessage(message) +): Boolean = deleteMessage(message) -suspend fun AccessibleMessage.delete( +public suspend fun AccessibleMessage.delete( requestsExecutor: TelegramBot -) = requestsExecutor.deleteMessage(this) +): Boolean = requestsExecutor.deleteMessage(this) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessages.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessages.kt index 85b0b2431e..c33187ab04 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessages.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessages.kt @@ -7,10 +7,10 @@ import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message import kotlin.jvm.JvmName -suspend fun TelegramBot.deleteMessages( +public suspend fun TelegramBot.deleteMessages( chatId: ChatIdentifier, messageIds: List -) = messageIds.chunked(deleteMessagesLimit.last).map { +): Boolean = messageIds.chunked(deleteMessagesLimit.last).map { execute( DeleteMessages( chatId = chatId, @@ -19,17 +19,17 @@ suspend fun TelegramBot.deleteMessages( ) }.all { it } -suspend fun TelegramBot.deleteMessages( +public suspend fun TelegramBot.deleteMessages( chatId: ChatIdentifier, messageIds: Array -) = deleteMessages( +): Boolean = deleteMessages( chatId = chatId, messageIds = messageIds.toList() ) -suspend fun TelegramBot.deleteMessages( +public suspend fun TelegramBot.deleteMessages( messagesMetas: List -) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) -> +): Boolean = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) -> deleteMessages( chatId = chatId, messageIds = messages.map { it.messageId } @@ -37,25 +37,25 @@ suspend fun TelegramBot.deleteMessages( }.all { it } @JvmName("deleteMessagesWithMessages") -suspend fun TelegramBot.deleteMessages( +public suspend fun TelegramBot.deleteMessages( messages: List -) = deleteMessages(messages.map { it.metaInfo }) +): Boolean = deleteMessages(messages.map { it.metaInfo }) -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( chatId: ChatIdentifier, messageIds: List -) = deleteMessages(chatId = chatId, messageIds = messageIds) +): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds) -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( chatId: ChatIdentifier, messageIds: Array -) = deleteMessages(chatId = chatId, messageIds = messageIds) +): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds) -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( messagesMetas: List -) = deleteMessages(messagesMetas) +): Boolean = deleteMessages(messagesMetas) @JvmName("deleteWithMessages") -suspend fun TelegramBot.delete( +public suspend fun TelegramBot.delete( messages: List -) = deleteMessages(messages) +): Boolean = deleteMessages(messages) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt index 8bdde19ab8..d196a5123d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessage.kt @@ -7,58 +7,59 @@ import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage +import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.threadId -suspend fun TelegramBot.forwardMessage( +public suspend fun TelegramBot.forwardMessage( fromChatId: ChatIdentifier, toChatId: ChatIdentifier, messageId: MessageId, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false -) = execute( +): PossiblyForwardedMessage = execute( ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent) ) -suspend fun TelegramBot.forwardMessage( +public suspend fun TelegramBot.forwardMessage( fromChat: Chat, toChatId: ChatIdentifier, messageId: MessageId, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false -) = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent) +): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent) -suspend fun TelegramBot.forwardMessage( +public suspend fun TelegramBot.forwardMessage( fromChatId: ChatIdentifier, toChat: Chat, messageId: MessageId, threadId: MessageThreadId? = toChat.id.threadId, disableNotification: Boolean = false, protectContent: Boolean = false -) = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent) +): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent) -suspend fun TelegramBot.forwardMessage( +public suspend fun TelegramBot.forwardMessage( fromChat: Chat, toChat: Chat, messageId: MessageId, threadId: MessageThreadId? = toChat.id.threadId, disableNotification: Boolean = false, protectContent: Boolean = false -) = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent) +): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent) -suspend fun TelegramBot.forwardMessage( +public suspend fun TelegramBot.forwardMessage( toChatId: ChatIdentifier, message: AccessibleMessage, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false -) = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent) +): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent) -suspend fun TelegramBot.forwardMessage( +public suspend fun TelegramBot.forwardMessage( toChat: Chat, message: AccessibleMessage, threadId: MessageThreadId? = toChat.id.threadId, disableNotification: Boolean = false, protectContent: Boolean = false -) = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent) +): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessages.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessages.kt index cf0775f0a5..aec91b3491 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessages.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/ForwardMessages.kt @@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message import kotlin.jvm.JvmName -suspend fun TelegramBot.forwardMessages( +public suspend fun TelegramBot.forwardMessages( toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: List, @@ -16,7 +16,7 @@ suspend fun TelegramBot.forwardMessages( disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = messageIds.chunked(forwardMessagesLimit.last).flatMap { +): List = messageIds.chunked(forwardMessagesLimit.last).flatMap { execute( ForwardMessages( toChatId = toChatId, @@ -30,7 +30,7 @@ suspend fun TelegramBot.forwardMessages( ) } -suspend fun TelegramBot.forwardMessages( +public suspend fun TelegramBot.forwardMessages( toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: Array, @@ -38,7 +38,7 @@ suspend fun TelegramBot.forwardMessages( disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = forwardMessages( +): List = forwardMessages( toChatId = toChatId, fromChatId = fromChatId, messageIds = messageIds.toList(), @@ -48,14 +48,14 @@ suspend fun TelegramBot.forwardMessages( removeCaption = removeCaption ) -suspend fun TelegramBot.forwardMessages( +public suspend fun TelegramBot.forwardMessages( toChatId: ChatIdentifier, messagesMetas: List, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) -> +): List = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) -> forwardMessages( toChatId = toChatId, fromChatId = chatId, @@ -68,14 +68,14 @@ suspend fun TelegramBot.forwardMessages( } @JvmName("forwardMessagesWithMessages") -suspend fun TelegramBot.forwardMessages( +public suspend fun TelegramBot.forwardMessages( toChatId: ChatIdentifier, messages: List, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = forwardMessages( +): List = forwardMessages( toChatId = toChatId, messagesMetas = messages.map { it.metaInfo }, threadId = threadId, @@ -84,7 +84,7 @@ suspend fun TelegramBot.forwardMessages( removeCaption = removeCaption ) -suspend fun TelegramBot.forward( +public suspend fun TelegramBot.forward( toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: List, @@ -92,7 +92,7 @@ suspend fun TelegramBot.forward( disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = forwardMessages( +): List = forwardMessages( toChatId = toChatId, fromChatId = fromChatId, messageIds = messageIds, @@ -102,7 +102,7 @@ suspend fun TelegramBot.forward( removeCaption = removeCaption ) -suspend fun TelegramBot.forward( +public suspend fun TelegramBot.forward( toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: Array, @@ -110,7 +110,7 @@ suspend fun TelegramBot.forward( disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = forwardMessages( +): List = forwardMessages( toChatId = toChatId, fromChatId = fromChatId, messageIds = messageIds, @@ -120,14 +120,14 @@ suspend fun TelegramBot.forward( removeCaption = removeCaption ) -suspend fun TelegramBot.forward( +public suspend fun TelegramBot.forward( toChatId: ChatIdentifier, messagesMetas: List, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = forwardMessages( +): List = forwardMessages( toChatId = toChatId, messagesMetas = messagesMetas, threadId = threadId, @@ -137,14 +137,14 @@ suspend fun TelegramBot.forward( ) @JvmName("forwardWithMessages") -suspend fun TelegramBot.forward( +public suspend fun TelegramBot.forward( toChatId: ChatIdentifier, messages: List, threadId: MessageThreadId? = toChatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false -) = forwardMessages( +): List = forwardMessages( toChatId = toChatId, messages = messages, threadId = threadId, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdates.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdates.kt index 2d1f68998f..8ebfc122eb 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdates.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdates.kt @@ -5,22 +5,22 @@ import dev.inmo.tgbotapi.requests.GetUpdates import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.update.abstracts.Update -suspend fun TelegramBot.getUpdates( +public suspend fun TelegramBot.getUpdates( offset: UpdateId? = null, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List? = ALL_UPDATES_LIST -) = execute( +): List = execute( GetUpdates( offset, limit, timeout, allowed_updates ) ) -suspend fun TelegramBot.getUpdates( +public suspend fun TelegramBot.getUpdates( lastUpdate: Update, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List? = ALL_UPDATES_LIST -) = getUpdates( +): List = getUpdates( lastUpdate.updateId + 1, limit, timeout, allowed_updates ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdatesRaw.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdatesRaw.kt index 154c335f67..9d31f8aa77 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdatesRaw.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/GetUpdatesRaw.kt @@ -4,23 +4,24 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.GetUpdatesRaw import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.update.abstracts.Update +import kotlinx.serialization.json.JsonArray -suspend fun TelegramBot.getRawUpdates( +public suspend fun TelegramBot.getRawUpdates( offset: UpdateId? = null, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List? = ALL_UPDATES_LIST -) = execute( +): JsonArray = execute( GetUpdatesRaw( offset, limit, timeout, allowed_updates ) ) -suspend fun TelegramBot.getRawUpdates( +public suspend fun TelegramBot.getRawUpdates( lastUpdate: Update, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List? = ALL_UPDATES_LIST -) = getRawUpdates( +): JsonArray = getRawUpdates( lastUpdate.updateId + 1, limit, timeout, allowed_updates ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt index 261d23379b..93852a49a0 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt @@ -1,9 +1,11 @@ package dev.inmo.tgbotapi.extensions.api -import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions -import dev.inmo.tgbotapi.abstracts.* +import dev.inmo.tgbotapi.abstracts.Headed +import dev.inmo.tgbotapi.abstracts.HorizontallyAccured +import dev.inmo.tgbotapi.abstracts.Locationed +import dev.inmo.tgbotapi.abstracts.ProximityAlertable import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.extensions.api.edit.edit @@ -16,17 +18,20 @@ import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.LocationContent -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineStart +import kotlinx.coroutines.currentCoroutineContext +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.map +import kotlinx.coroutines.isActive import kotlinx.serialization.Serializable import kotlin.js.JsName import kotlin.jvm.JvmName import kotlin.math.ceil @Serializable -data class EditLiveLocationInfo( +public data class EditLiveLocationInfo( override val latitude: Double, override val longitude: Double, override val horizontalAccuracy: Meters? = null, @@ -39,7 +44,7 @@ data class EditLiveLocationInfo( * Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing, * the message will be sent again and new edits will be applied to the new message */ -suspend fun TelegramBot.handleLiveLocation( +public suspend fun TelegramBot.handleLiveLocation( chatId: ChatIdentifier, locationsFlow: Flow, liveTimeMillis: Long = defaultLivePeriodDelayMillis, @@ -112,7 +117,7 @@ suspend fun TelegramBot.handleLiveLocation( */ @JvmName("handleLiveLocationWithLocation") @JsName("handleLiveLocationWithLocation") -suspend fun TelegramBot.handleLiveLocation( +public suspend fun TelegramBot.handleLiveLocation( chatId: ChatIdentifier, locationsFlow: Flow, liveTimeMillis: Long = defaultLivePeriodDelayMillis, @@ -153,7 +158,7 @@ suspend fun TelegramBot.handleLiveLocation( */ @JvmName("handleLiveLocationWithLatLong") @JsName("handleLiveLocationWithLatLong") -suspend fun TelegramBot.handleLiveLocation( +public suspend fun TelegramBot.handleLiveLocation( chatId: ChatIdentifier, locationsFlow: Flow>, liveTimeMillis: Long = defaultLivePeriodDelayMillis, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt index ea67a21bd6..9963a09ed7 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt @@ -23,13 +23,13 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import kotlin.math.ceil -const val indefiniteLivePeriodDelayMillis = LiveLocation.INDEFINITE_LIVE_PERIOD * 1000L -const val defaultLivePeriodDelayMillis = indefiniteLivePeriodDelayMillis +public const val indefiniteLivePeriodDelayMillis: Long = LiveLocation.INDEFINITE_LIVE_PERIOD * 1000L +public const val defaultLivePeriodDelayMillis: Long = indefiniteLivePeriodDelayMillis /** * @see startLiveLocation */ -class LiveLocationProvider internal constructor( +public class LiveLocationProvider internal constructor( private val requestsExecutor: TelegramBot, scope: CoroutineScope, autoCloseTimeDelay: Double, @@ -41,23 +41,23 @@ class LiveLocationProvider internal constructor( } } private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay) - val leftUntilCloseMillis: TimeSpan + public val leftUntilCloseMillis: TimeSpan get() = autoCloseTime - DateTime.now() - var isClosed: Boolean = false + public var isClosed: Boolean = false private set get() = field || leftUntilCloseMillis.millisecondsLong < 0L - var message: ContentMessage = initMessage + public var message: ContentMessage = initMessage private set - val lastLocation: LiveLocation + public val lastLocation: LiveLocation get() = message.content.location as LiveLocation /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * as a builder for that */ - suspend fun updateLocation( + public suspend fun updateLocation( location: LiveLocation, replyMarkup: InlineKeyboardMarkup? = null ): LiveLocation { @@ -86,7 +86,7 @@ class LiveLocationProvider internal constructor( * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param */ -suspend fun TelegramBot.startLiveLocation( +public suspend fun TelegramBot.startLiveLocation( scope: CoroutineScope, chatId: ChatIdentifier, latitude: Double, @@ -135,7 +135,7 @@ suspend fun TelegramBot.startLiveLocation( * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param */ -suspend fun TelegramBot.startLiveLocation( +public suspend fun TelegramBot.startLiveLocation( scope: CoroutineScope, chat: Chat, latitude: Double, @@ -173,7 +173,7 @@ suspend fun TelegramBot.startLiveLocation( * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param */ -suspend fun TelegramBot.startLiveLocation( +public suspend fun TelegramBot.startLiveLocation( scope: CoroutineScope, chatId: IdChatIdentifier, location: StaticLocation, @@ -210,7 +210,7 @@ suspend fun TelegramBot.startLiveLocation( * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param */ -suspend fun TelegramBot.startLiveLocation( +public suspend fun TelegramBot.startLiveLocation( scope: CoroutineScope, chat: Chat, location: StaticLocation, @@ -247,7 +247,7 @@ suspend fun TelegramBot.startLiveLocation( * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param */ -suspend inline fun TelegramBot.replyWithLiveLocation( +public suspend inline fun TelegramBot.replyWithLiveLocation( to: AccessibleMessage, scope: CoroutineScope, latitude: Double, @@ -263,7 +263,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation( effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = startLiveLocation( +): LiveLocationProvider = startLiveLocation( scope, to.chat, latitude, @@ -285,7 +285,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation( * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param */ -suspend inline fun TelegramBot.replyWithLiveLocation( +public suspend inline fun TelegramBot.replyWithLiveLocation( to: AccessibleMessage, scope: CoroutineScope, location: StaticLocation, @@ -300,7 +300,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation( effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = startLiveLocation( +): LiveLocationProvider = startLiveLocation( scope, to.chat, location, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LogOut.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LogOut.kt index 23d5c8daeb..34222e454f 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LogOut.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LogOut.kt @@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.local.LogOut -suspend inline fun TelegramBot.logOut() = execute(LogOut) +public suspend inline fun TelegramBot.logOut(): Boolean = execute(LogOut) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/StopPoll.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/StopPoll.kt index 4b799e4ecc..8d023a48ea 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/StopPoll.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/StopPoll.kt @@ -7,17 +7,18 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage +import dev.inmo.tgbotapi.types.polls.Poll /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * as a builder for that */ -suspend fun TelegramBot.stopPoll( +public suspend fun TelegramBot.stopPoll( chatId: ChatIdentifier, messageId: MessageId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -) = execute( +): Poll = execute( StopPoll(chatId, messageId, businessConnectionId, replyMarkup) ) @@ -25,31 +26,31 @@ suspend fun TelegramBot.stopPoll( * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * as a builder for that */ -suspend fun TelegramBot.stopPoll( +public suspend fun TelegramBot.stopPoll( chat: Chat, messageId: MessageId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -) = stopPoll(chat.id, messageId, businessConnectionId, replyMarkup) +): Poll = stopPoll(chat.id, messageId, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * as a builder for that */ -suspend fun TelegramBot.stopPoll( +public suspend fun TelegramBot.stopPoll( chatId: IdChatIdentifier, message: AccessibleMessage, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -) = stopPoll(chatId, message.messageId, businessConnectionId, replyMarkup) +): Poll = stopPoll(chatId, message.messageId, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * as a builder for that */ -suspend fun TelegramBot.stopPoll( +public suspend fun TelegramBot.stopPoll( chat: Chat, message: AccessibleMessage, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -) = stopPoll(chat.id, message.messageId, businessConnectionId, replyMarkup) +): Poll = stopPoll(chat.id, message.messageId, businessConnectionId, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt index 566d4a3e57..d57f073a2f 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt @@ -12,38 +12,38 @@ import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.stickers.MaskPosition import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( userId: UserId, stickerSetName: StickerSetName, inputSticker: InputSticker -) = execute( +): Boolean = execute( AddStickerToSet(userId, stickerSetName, inputSticker) ) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( userId: UserId, stickerSetName: String, inputSticker: InputSticker -) = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker) +): Boolean = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( userId: UserId, stickerSet: StickerSet, sticker: InputSticker -) = addStickerToSet( +): Boolean = addStickerToSet( userId, stickerSet.name, sticker ) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( userId: UserId, stickerSet: StickerSet, sticker: InputFile, format: StickerFormat, emojis: List, keywords: List = emptyList() -) = addStickerToSet( +): Boolean = addStickerToSet( userId, stickerSet, when (stickerSet.stickerType) { @@ -68,14 +68,14 @@ suspend fun TelegramBot.addStickerToSet( } ) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( userId: UserId, stickerSet: StickerSet, sticker: InputFile, format: StickerFormat, emojis: List, maskPosition: MaskPosition? = null -) = addStickerToSet( +): Boolean = addStickerToSet( userId, stickerSet.name, when (stickerSet.stickerType) { @@ -101,34 +101,34 @@ suspend fun TelegramBot.addStickerToSet( } ) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( user: CommonUser, stickerSet: StickerSet, sticker: InputSticker -) = addStickerToSet( +): Boolean = addStickerToSet( user.id, stickerSet.name, sticker ) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( user: CommonUser, stickerSet: StickerSet, sticker: InputFile, format: StickerFormat, emojis: List, keywords: List = emptyList() -) = addStickerToSet( +): Boolean = addStickerToSet( user.id, stickerSet, sticker, format, emojis, keywords ) -suspend fun TelegramBot.addStickerToSet( +public suspend fun TelegramBot.addStickerToSet( user: CommonUser, stickerSet: StickerSet, sticker: InputFile, format: StickerFormat, emojis: List, maskPosition: MaskPosition? = null -) = addStickerToSet( +): Boolean = addStickerToSet( user.id, stickerSet, sticker, format, emojis, maskPosition ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/CreateNewStickerSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/CreateNewStickerSet.kt index fa9099e30b..4784fbceb3 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/CreateNewStickerSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/CreateNewStickerSet.kt @@ -7,23 +7,23 @@ import dev.inmo.tgbotapi.types.StickerFormat import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.UserId -suspend fun TelegramBot.createNewStickerSet( +public suspend fun TelegramBot.createNewStickerSet( userId: UserId, name: String, title: String, stickers: List, needsRepainting: Boolean = false -) = execute( +): Boolean = execute( CreateNewStickerSet(userId, name, title, stickers, needsRepainting) ) -suspend fun TelegramBot.createNewStickerSet( +public suspend fun TelegramBot.createNewStickerSet( user: CommonUser, name: String, title: String, stickers: List, needsRepainting: Boolean = false, -) = createNewStickerSet( +): Boolean = createNewStickerSet( user.id, name, title, stickers, needsRepainting ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt index 29be658518..4259a4488e 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt @@ -5,16 +5,16 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet import dev.inmo.tgbotapi.types.files.Sticker -suspend fun TelegramBot.deleteStickerFromSet( +public suspend fun TelegramBot.deleteStickerFromSet( sticker: FileId -) = execute( +): Boolean = execute( DeleteStickerFromSet( sticker ) ) -suspend fun TelegramBot.deleteStickerFromSet( +public suspend fun TelegramBot.deleteStickerFromSet( sticker: Sticker -) = deleteStickerFromSet( +): Boolean = deleteStickerFromSet( sticker.fileId ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt index bae7665e09..77a7ecd67d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt @@ -8,18 +8,18 @@ import dev.inmo.tgbotapi.types.StickerSetName import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.deleteStickerSet( +public suspend fun TelegramBot.deleteStickerSet( name: StickerSetName -) = execute( +): Boolean = execute( DeleteStickerSet(name) ) -suspend fun TelegramBot.deleteStickerSet( +public suspend fun TelegramBot.deleteStickerSet( sticker: Sticker -) = deleteStickerSet( +): Boolean = deleteStickerSet( sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker") ) -suspend fun TelegramBot.deleteStickerSet( +public suspend fun TelegramBot.deleteStickerSet( stickerSet: StickerSet, -) = deleteStickerSet(stickerSet.name) +): Boolean = deleteStickerSet(stickerSet.name) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/ReplaceStickerInSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/ReplaceStickerInSet.kt index 376446dce4..eea1790d53 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/ReplaceStickerInSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/ReplaceStickerInSet.kt @@ -14,35 +14,35 @@ import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.stickers.MaskPosition import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( userId: UserId, stickerSetName: StickerSetName, oldSticker: FileId, newSticker: InputSticker -) = execute( +): Boolean = execute( ReplaceStickerInSet(userId, stickerSetName, oldSticker, newSticker) ) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( userId: UserId, stickerSetName: String, oldSticker: FileId, newSticker: InputSticker -) = replaceStickerInSet(userId, StickerSetName(stickerSetName), oldSticker, newSticker) +): Boolean = replaceStickerInSet(userId, StickerSetName(stickerSetName), oldSticker, newSticker) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( userId: UserId, stickerSet: StickerSet, oldSticker: FileId, newSticker: InputSticker -) = replaceStickerInSet( +): Boolean = replaceStickerInSet( userId, stickerSet.name, oldSticker, newSticker ) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( userId: UserId, stickerSet: StickerSet, oldSticker: FileId, @@ -50,7 +50,7 @@ suspend fun TelegramBot.replaceStickerInSet( format: StickerFormat, emojis: List, keywords: List = emptyList() -) = replaceStickerInSet( +): Boolean = replaceStickerInSet( userId, stickerSet, oldSticker, @@ -76,7 +76,7 @@ suspend fun TelegramBot.replaceStickerInSet( } ) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( userId: UserId, stickerSet: StickerSet, oldSticker: FileId, @@ -84,7 +84,7 @@ suspend fun TelegramBot.replaceStickerInSet( format: StickerFormat, emojis: List, maskPosition: MaskPosition? = null -) = replaceStickerInSet( +): Boolean = replaceStickerInSet( userId, stickerSet.name, oldSticker, @@ -111,19 +111,19 @@ suspend fun TelegramBot.replaceStickerInSet( } ) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( user: CommonUser, stickerSet: StickerSet, oldSticker: FileId, newSticker: InputSticker -) = replaceStickerInSet( +): Boolean = replaceStickerInSet( user.id, stickerSet.name, oldSticker, newSticker ) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( user: CommonUser, stickerSet: StickerSet, oldSticker: FileId, @@ -131,11 +131,11 @@ suspend fun TelegramBot.replaceStickerInSet( format: StickerFormat, emojis: List, keywords: List = emptyList() -) = replaceStickerInSet( +): Boolean = replaceStickerInSet( user.id, stickerSet, oldSticker, sticker, format, emojis, keywords ) -suspend fun TelegramBot.replaceStickerInSet( +public suspend fun TelegramBot.replaceStickerInSet( user: CommonUser, stickerSet: StickerSet, oldSticker: FileId, @@ -143,6 +143,6 @@ suspend fun TelegramBot.replaceStickerInSet( format: StickerFormat, emojis: List, maskPosition: MaskPosition? = null -) = replaceStickerInSet( +): Boolean = replaceStickerInSet( user.id, stickerSet, oldSticker, sticker, format, emojis, maskPosition ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetCustomEmojiStickerSetThumb.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetCustomEmojiStickerSetThumb.kt index b75abd9786..b099390a62 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetCustomEmojiStickerSetThumb.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetCustomEmojiStickerSetThumb.kt @@ -11,16 +11,16 @@ import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail( +public suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail( stickerSetName: StickerSetName, customEmojiId: CustomEmojiId -) = execute( +): Boolean = execute( SetCustomEmojiStickerSetThumbnail(stickerSetName, customEmojiId) ) -suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail( +public suspend fun TelegramBot.setCustomEmojiStickerSetThumbnail( stickerSet: StickerSet, customEmojiId: CustomEmojiId -) = setCustomEmojiStickerSetThumbnail( +): Boolean = setCustomEmojiStickerSetThumbnail( stickerSet.name, customEmojiId ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerEmojiList.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerEmojiList.kt index b8b1a45f5c..f6c49f68a1 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerEmojiList.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerEmojiList.kt @@ -6,20 +6,20 @@ import dev.inmo.tgbotapi.requests.stickers.SetStickerEmojiList import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet import dev.inmo.tgbotapi.types.files.Sticker -suspend fun TelegramBot.setStickerEmojiList( +public suspend fun TelegramBot.setStickerEmojiList( sticker: FileId, emojis: List -) = execute( +): Boolean = execute( SetStickerEmojiList( sticker, emojis ) ) -suspend fun TelegramBot.setStickerEmojiList( +public suspend fun TelegramBot.setStickerEmojiList( sticker: Sticker, vararg emojis: String -) = setStickerEmojiList( +): Boolean = setStickerEmojiList( sticker.fileId, emojis.toList() ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerKeywords.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerKeywords.kt index 2653455511..7764dac237 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerKeywords.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerKeywords.kt @@ -7,20 +7,20 @@ import dev.inmo.tgbotapi.requests.stickers.SetStickerKeywords import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet import dev.inmo.tgbotapi.types.files.Sticker -suspend fun TelegramBot.setStickerKeywords( +public suspend fun TelegramBot.setStickerKeywords( sticker: FileId, keywords: List -) = execute( +): Boolean = execute( SetStickerKeywords( sticker, keywords ) ) -suspend fun TelegramBot.setStickerKeywords( +public suspend fun TelegramBot.setStickerKeywords( sticker: Sticker, vararg keywords: String -) = setStickerKeywords( +): Boolean = setStickerKeywords( sticker.fileId, keywords.toList() ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerMaskPosition.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerMaskPosition.kt index 7d05db2349..b14ea832a9 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerMaskPosition.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerMaskPosition.kt @@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.stickers.MaskPosition -suspend fun TelegramBot.setStickerMaskPosition( +public suspend fun TelegramBot.setStickerMaskPosition( sticker: FileId, maskPosition: MaskPosition -) = execute( +): Boolean = execute( SetStickerMaskPosition( sticker, maskPosition diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt index affe3f2056..d12de74958 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt @@ -5,20 +5,20 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet import dev.inmo.tgbotapi.types.files.Sticker -suspend fun TelegramBot.setStickerPositionInSet( +public suspend fun TelegramBot.setStickerPositionInSet( sticker: FileId, position: Int -) = execute( +): Boolean = execute( SetStickerPositionInSet( sticker, position ) ) -suspend fun TelegramBot.setStickerPositionInSet( +public suspend fun TelegramBot.setStickerPositionInSet( sticker: Sticker, position: Int -) = setStickerPositionInSet( +): Boolean = setStickerPositionInSet( sticker.fileId, position ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumbnail.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumbnail.kt index 492533e890..4b1178681d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumbnail.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumbnail.kt @@ -10,74 +10,74 @@ import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( userId: UserId, stickerSetName: StickerSetName, format: StickerFormat, thumbnail: FileId -) = execute( +): Boolean = execute( SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail) ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( userId: UserId, stickerSetName: StickerSetName, format: StickerFormat, thumbnail: MultipartFile -) = execute( +): Boolean = execute( SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail) ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( user: CommonUser, stickerSetName: StickerSetName, format: StickerFormat, thumbnail: FileId -) = setStickerSetThumbnail( +): Boolean = setStickerSetThumbnail( user.id, stickerSetName, format, thumbnail ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( user: CommonUser, stickerSetName: StickerSetName, format: StickerFormat, thumbnail: MultipartFile -) = setStickerSetThumbnail( +): Boolean = setStickerSetThumbnail( user.id, stickerSetName, format, thumbnail ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( userId: UserId, stickerSet: StickerSet, format: StickerFormat, thumbnail: FileId -) = setStickerSetThumbnail( +): Boolean = setStickerSetThumbnail( userId, stickerSet.name, format, thumbnail ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( userId: UserId, stickerSet: StickerSet, format: StickerFormat, thumbnail: MultipartFile -) = setStickerSetThumbnail( +): Boolean = setStickerSetThumbnail( userId, stickerSet.name, format, thumbnail ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( user: CommonUser, stickerSet: StickerSet, format: StickerFormat, thumbnail: FileId -) = setStickerSetThumbnail( +): Boolean = setStickerSetThumbnail( user.id, stickerSet, format, thumbnail ) -suspend fun TelegramBot.setStickerSetThumbnail( +public suspend fun TelegramBot.setStickerSetThumbnail( user: CommonUser, stickerSet: StickerSet, format: StickerFormat, thumbnail: MultipartFile -) = setStickerSetThumbnail( +): Boolean = setStickerSetThumbnail( user.id, stickerSet, format, thumbnail ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetTitle.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetTitle.kt index dea01e2f61..7596891a50 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetTitle.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetTitle.kt @@ -6,17 +6,17 @@ import dev.inmo.tgbotapi.types.StickerSetName import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.setStickerSetTitle( +public suspend fun TelegramBot.setStickerSetTitle( name: StickerSetName, title: String -) = execute(SetStickerSetTitle(name, title)) +): Boolean = execute(SetStickerSetTitle(name, title)) -suspend fun TelegramBot.setStickerSetTitle( +public suspend fun TelegramBot.setStickerSetTitle( sticker: Sticker, title: String -) = setStickerSetTitle(sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker"), title) +): Boolean = setStickerSetTitle(sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker"), title) -suspend fun TelegramBot.setStickerSetTitle( +public suspend fun TelegramBot.setStickerSetTitle( stickerSet: StickerSet, title: String -) = setStickerSetTitle(stickerSet.name, title) +): Boolean = setStickerSetTitle(stickerSet.name, title) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/UploadStickerFile.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/UploadStickerFile.kt index 64cce2e2a4..99d38425a7 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/UploadStickerFile.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/UploadStickerFile.kt @@ -6,19 +6,20 @@ import dev.inmo.tgbotapi.requests.stickers.UploadStickerFile import dev.inmo.tgbotapi.types.StickerFormat import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.UserId +import dev.inmo.tgbotapi.types.files.File -suspend fun TelegramBot.uploadStickerFile( +public suspend fun TelegramBot.uploadStickerFile( userId: UserId, sticker: MultipartFile, stickerFormat: StickerFormat -) = execute( +): File = execute( UploadStickerFile(userId, sticker, stickerFormat) ) -suspend fun TelegramBot.uploadStickerFile( +public suspend fun TelegramBot.uploadStickerFile( user: CommonUser, sticker: MultipartFile, stickerFormat: StickerFormat -) = execute( +): File = execute( UploadStickerFile(user.id, sticker, stickerFormat) ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt index c0ad2cd264..ecb1e5a9b1 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt @@ -17,7 +17,7 @@ import kotlinx.coroutines.launch * * @see UpdateReceiver */ -fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation( +public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation( output: UpdateReceiver, mediaGroupsDebounceMillis: Long = 1000L ): UpdateReceiver { diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/DeleteWebhook.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/DeleteWebhook.kt index 9f503bc1dc..b4b25ffd93 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/DeleteWebhook.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/DeleteWebhook.kt @@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api.webhook import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.webhook.DeleteWebhook -suspend fun TelegramBot.deleteWebhook() = execute(DeleteWebhook()) +public suspend fun TelegramBot.deleteWebhook(): Boolean = execute(DeleteWebhook()) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/GetWebhookInfo.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/GetWebhookInfo.kt index d1fabc7e55..5d8cf0147b 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/GetWebhookInfo.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/GetWebhookInfo.kt @@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.webhook import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.webhook.GetWebhookInfo +import dev.inmo.tgbotapi.types.WebhookInfo -suspend fun TelegramBot.getWebhookInfo() = execute(GetWebhookInfo()) +public suspend fun TelegramBot.getWebhookInfo(): WebhookInfo = execute(GetWebhookInfo()) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/SetWebhookInfo.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/SetWebhookInfo.kt index d2a986c5c2..162f89e6ab 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/SetWebhookInfo.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/webhook/SetWebhookInfo.kt @@ -9,14 +9,14 @@ import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST /** * Use this method to send information about webhook (like [url]) */ -suspend fun TelegramBot.setWebhookInfo( +public suspend fun TelegramBot.setWebhookInfo( url: String, ipAddress: String? = null, maxAllowedConnections: Int? = null, allowedUpdates: List? = ALL_UPDATES_LIST, dropPendingUpdates: Boolean? = null, secretToken: String? = null -) = execute( +): Boolean = execute( SetWebhook( url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken ) @@ -25,7 +25,7 @@ suspend fun TelegramBot.setWebhookInfo( /** * Use this method to send information about webhook (like [url] and [certificate]) */ -suspend fun TelegramBot.setWebhookInfo( +public suspend fun TelegramBot.setWebhookInfo( url: String, certificate: FileId, ipAddress: String? = null, @@ -33,7 +33,7 @@ suspend fun TelegramBot.setWebhookInfo( allowedUpdates: List? = ALL_UPDATES_LIST, dropPendingUpdates: Boolean? = null, secretToken: String? = null -) = execute( +): Boolean = execute( SetWebhook( url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken ) @@ -42,7 +42,7 @@ suspend fun TelegramBot.setWebhookInfo( /** * Use this method to send information about webhook (like [url] and [certificate]) */ -suspend fun TelegramBot.setWebhookInfo( +public suspend fun TelegramBot.setWebhookInfo( url: String, certificate: MultipartFile, ipAddress: String? = null, @@ -50,7 +50,7 @@ suspend fun TelegramBot.setWebhookInfo( allowedUpdates: List? = ALL_UPDATES_LIST, dropPendingUpdates: Boolean? = null, secretToken: String? = null -) = execute( +): Boolean = execute( SetWebhook( url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken )