From 8ef7acab2dea8374c1c1e963c8aa70b28fc14d67 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 30 Mar 2020 21:33:17 +0600 Subject: [PATCH] sendDice in extensions api --- CHANGELOG.md | 2 ++ .../extensions/api/send/SendDice.kt | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/SendDice.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ba140caa0..c323f89e82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ * Request `SendDice` was added (calling [sendDice](https://core.telegram.org/bots/api#senddice)) * Class `Dice` was added (type [dice](https://core.telegram.org/bots/api#dice)) * Class `DiceContent` was added (for including it in [message](https://core.telegram.org/bots/api#message) object) +* `TelegramBotAPI-extensions-api`: + * Extensions `sendDice` was added ### 0.25.1 diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/SendDice.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/SendDice.kt new file mode 100644 index 0000000000..c0e7f89442 --- /dev/null +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/SendDice.kt @@ -0,0 +1,24 @@ +package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send + +import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor +import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendDice +import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier +import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier +import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup +import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat + +suspend fun RequestsExecutor.sendDice( + chatId: ChatIdentifier, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null +) = execute( + SendDice(chatId, disableNotification, replyToMessageId, replyMarkup) +) + +suspend fun RequestsExecutor.sendDice( + chat: Chat, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null +) = sendDice(chat.id, disableNotification, replyToMessageId, replyMarkup)