From cad6b26fdcf1ebb9624aef462385f9b9f4de88fe Mon Sep 17 00:00:00 2001 From: bpavuk Date: Fri, 12 Jul 2024 22:07:36 +0300 Subject: [PATCH] moving to an explicit API mode refactored `games` package --- .../api/games/GetGameHighScoresByChat.kt | 25 ++++++++++--------- .../GetGameHighScoresByInlineMessageId.kt | 9 ++++--- .../api/games/SetGameScoreByChatId.kt | 24 +++++++++--------- .../games/SetGameScoreByInlineMessageId.kt | 8 +++--- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByChat.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByChat.kt index 8231aa89d0..7c5d133e14 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByChat.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByChat.kt @@ -5,51 +5,52 @@ import dev.inmo.tgbotapi.requests.games.GetGameHighScoresByChat import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.CommonUser +import dev.inmo.tgbotapi.types.games.GameHighScore import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.GameContent -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( userId: UserId, chatId: IdChatIdentifier, messageId: MessageId -) = execute( +): List = execute( GetGameHighScoresByChat(userId, chatId, messageId) ) -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( user: CommonUser, chatId: IdChatIdentifier, messageId: MessageId -) = getGameScore( +): List = getGameScore( user.id, chatId, messageId ) -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( userId: UserId, chat: Chat, messageId: MessageId -) = getGameScore( +): List = getGameScore( userId, chat.id, messageId ) -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( user: CommonUser, chat: Chat, messageId: MessageId -) = getGameScore( +): List = getGameScore( user.id, chat.id, messageId ) -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( userId: UserId, message: ContentMessage -) = getGameScore( +): List = getGameScore( userId, message.chat.id, message.messageId ) -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( user: CommonUser, message: ContentMessage -) = getGameScore( +): List = getGameScore( user.id, message.chat.id, message.messageId ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByInlineMessageId.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByInlineMessageId.kt index 7f8f31bfc2..0a73094e22 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByInlineMessageId.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/GetGameHighScoresByInlineMessageId.kt @@ -4,17 +4,18 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.games.GetGameHighScoresByInlineMessageId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.CommonUser +import dev.inmo.tgbotapi.types.games.GameHighScore -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( userId: UserId, inlineMessageId: InlineMessageId -) = execute( +): List = execute( GetGameHighScoresByInlineMessageId( userId, inlineMessageId ) ) -suspend fun TelegramBot.getGameScore( +public suspend fun TelegramBot.getGameScore( user: CommonUser, inlineMessageId: InlineMessageId -) = getGameScore(user.id, inlineMessageId) +): List = getGameScore(user.id, inlineMessageId) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByChatId.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByChatId.kt index 6976858703..c0e1d338ea 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByChatId.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByChatId.kt @@ -8,66 +8,66 @@ import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.GameContent -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( userId: UserId, score: Long, chatId: IdChatIdentifier, messageId: MessageId, force: Boolean = false, disableEditMessage: Boolean = false -) = execute( +): Boolean = execute( SetGameScoreByChatId(userId, score, chatId, messageId, force, disableEditMessage) ) -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( user: CommonUser, score: Long, chatId: IdChatIdentifier, messageId: MessageId, force: Boolean = false, disableEditMessage: Boolean = false -) = setGameScore( +): Boolean = setGameScore( user.id, score, chatId, messageId, force, disableEditMessage ) -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( userId: UserId, score: Long, chat: Chat, messageId: MessageId, force: Boolean = false, disableEditMessage: Boolean = false -) = setGameScore( +): Boolean = setGameScore( userId, score, chat.id, messageId, force, disableEditMessage ) -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( user: CommonUser, score: Long, chat: Chat, messageId: MessageId, force: Boolean = false, disableEditMessage: Boolean = false -) = setGameScore( +): Boolean = setGameScore( user.id, score, chat.id, messageId, force, disableEditMessage ) -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( userId: UserId, score: Long, message: ContentMessage, force: Boolean = false, disableEditMessage: Boolean = false -) = setGameScore( +): Boolean = setGameScore( userId, score, message.chat.id, message.messageId, force, disableEditMessage ) -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( user: CommonUser, score: Long, message: ContentMessage, force: Boolean = false, disableEditMessage: Boolean = false -) = setGameScore( +): Boolean = setGameScore( user.id, score, message.chat.id, message.messageId, force, disableEditMessage ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByInlineMessageId.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByInlineMessageId.kt index 5a79c0f790..a9f8965683 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByInlineMessageId.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/games/SetGameScoreByInlineMessageId.kt @@ -5,22 +5,22 @@ import dev.inmo.tgbotapi.requests.games.SetGameScoreByInlineMessageId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.CommonUser -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( userId: UserId, score: Long, inlineMessageId: InlineMessageId, force: Boolean = false, disableEditMessage: Boolean = false -) = execute( +): Boolean = execute( SetGameScoreByInlineMessageId( userId, score, inlineMessageId, force, disableEditMessage ) ) -suspend fun TelegramBot.setGameScore( +public suspend fun TelegramBot.setGameScore( user: CommonUser, score: Long, inlineMessageId: InlineMessageId, force: Boolean = false, disableEditMessage: Boolean = false -) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage) +): Boolean = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage)