tgbotapi/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/bot/SetMyCommands.kt

33 lines
1.2 KiB
Kotlin
Raw Normal View History

package dev.inmo.tgbotapi.extensions.api.bot
2020-03-30 15:52:00 +00:00
2021-08-05 17:36:01 +00:00
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
import dev.inmo.tgbotapi.types.BotCommand
2021-06-25 19:42:35 +00:00
import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
2020-03-30 15:52:00 +00:00
suspend fun TelegramBot.setMyCommands(
2021-06-25 19:42:35 +00:00
commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault,
2021-08-05 17:36:01 +00:00
languageCode: IetfLanguageCode?
2021-06-25 19:42:35 +00:00
) = execute(SetMyCommands(commands, scope, languageCode))
2020-06-02 13:54:13 +00:00
2021-08-05 17:36:01 +00:00
suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLanguageCode?
) = setMyCommands(commands.toList(), scope, languageCode)
suspend fun TelegramBot.setMyCommands(
commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLanguageCode))
suspend fun TelegramBot.setMyCommands(
2021-06-25 19:42:35 +00:00
vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null
) = setMyCommands(commands.toList(), scope, languageCode)