From 9405aa4467406e4b32deb6e415b1c455037bf356 Mon Sep 17 00:00:00 2001 From: d1snin Date: Wed, 12 Oct 2022 20:57:42 +0300 Subject: [PATCH] added `EntitiesBuilder.botCommand` and `EntitiesBuilder.botCommandln` overloads supporting `BotCommand` --- .../kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt index 8960195a75..b9aa8e93d5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/EntitiesBuilder.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.utils import dev.inmo.micro_utils.common.joinTo +import dev.inmo.tgbotapi.types.BotCommand import dev.inmo.tgbotapi.types.CustomEmojiId import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.message.textsources.* @@ -148,6 +149,15 @@ inline fun EntitiesBuilder.botCommand(command: String) = add(dev.inmo.tgbotapi.t * Version of [EntitiesBuilder.botCommand] with new line at the end */ inline fun EntitiesBuilder.botCommandln(command: String) = botCommand(command) + newLine +/** + * Add botCommand using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.message.textsources.botCommand] + */ +inline fun EntitiesBuilder.botCommand(botCommand: BotCommand) = add(dev.inmo.tgbotapi.types.message.textsources.botCommand(botCommand.command)) +/** + * Version of [EntitiesBuilder.botCommand] with new line at the end + */ +inline fun EntitiesBuilder.botCommandln(botCommand: BotCommand) = botCommand(botCommand.command) + newLine + /**