1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-03-23 11:14:47 +00:00

*MyCommands actualization

This commit is contained in:
2021-06-26 01:42:35 +06:00
parent b60fab4871
commit 7f69052dea
9 changed files with 79 additions and 9 deletions

View File

@@ -0,0 +1,11 @@
package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.deleteMyCommands(
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null
) = execute(DeleteMyCommands(scope, languageCode))

View File

@@ -2,5 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.getMyCommands() = execute(GetMyCommands)
suspend fun TelegramBot.getMyCommands(
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null
) = execute(GetMyCommands(scope, languageCode))

View File

@@ -3,11 +3,17 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
import dev.inmo.tgbotapi.types.BotCommand
import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.setMyCommands(
commands: List<BotCommand>
) = execute(SetMyCommands(commands))
commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null
) = execute(SetMyCommands(commands, scope, languageCode))
suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand
) = setMyCommands(commands.toList())
vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null
) = setMyCommands(commands.toList(), scope, languageCode)