1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 03:28:44 +00:00

moving to an explicit API mode

refactored `games` package
This commit is contained in:
bpavuk 2024-07-12 22:07:36 +03:00
parent 52f17178ab
commit cad6b26fdc
No known key found for this signature in database
GPG Key ID: B501D26D9DEA9CFE
4 changed files with 34 additions and 32 deletions

View File

@ -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<GameHighScore> = execute(
GetGameHighScoresByChat(userId, chatId, messageId)
)
suspend fun TelegramBot.getGameScore(
public suspend fun TelegramBot.getGameScore(
user: CommonUser,
chatId: IdChatIdentifier,
messageId: MessageId
) = getGameScore(
): List<GameHighScore> = getGameScore(
user.id, chatId, messageId
)
suspend fun TelegramBot.getGameScore(
public suspend fun TelegramBot.getGameScore(
userId: UserId,
chat: Chat,
messageId: MessageId
) = getGameScore(
): List<GameHighScore> = getGameScore(
userId, chat.id, messageId
)
suspend fun TelegramBot.getGameScore(
public suspend fun TelegramBot.getGameScore(
user: CommonUser,
chat: Chat,
messageId: MessageId
) = getGameScore(
): List<GameHighScore> = getGameScore(
user.id, chat.id, messageId
)
suspend fun TelegramBot.getGameScore(
public suspend fun TelegramBot.getGameScore(
userId: UserId,
message: ContentMessage<GameContent>
) = getGameScore(
): List<GameHighScore> = getGameScore(
userId, message.chat.id, message.messageId
)
suspend fun TelegramBot.getGameScore(
public suspend fun TelegramBot.getGameScore(
user: CommonUser,
message: ContentMessage<GameContent>
) = getGameScore(
): List<GameHighScore> = getGameScore(
user.id, message.chat.id, message.messageId
)

View File

@ -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<GameHighScore> = execute(
GetGameHighScoresByInlineMessageId(
userId, inlineMessageId
)
)
suspend fun TelegramBot.getGameScore(
public suspend fun TelegramBot.getGameScore(
user: CommonUser,
inlineMessageId: InlineMessageId
) = getGameScore(user.id, inlineMessageId)
): List<GameHighScore> = getGameScore(user.id, inlineMessageId)

View File

@ -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<GameContent>,
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<GameContent>,
force: Boolean = false,
disableEditMessage: Boolean = false
) = setGameScore(
): Boolean = setGameScore(
user.id, score, message.chat.id, message.messageId, force, disableEditMessage
)

View File

@ -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)