diff --git a/modules/app.py b/modules/app.py index 757e61b..b9ac8da 100644 --- a/modules/app.py +++ b/modules/app.py @@ -7,6 +7,7 @@ from libbot import config_get from pyrogram.client import Client from pyrogram.errors import BadRequest from pyrogram.raw.all import layer +from pyrogram.types import BotCommand, BotCommandScopeChat from ujson import loads logger = logging.getLogger(__name__) @@ -47,6 +48,50 @@ class PyroClient(Client): except BadRequest: logger.warning("Unable to send message to report chat.") + await self.set_bot_commands( + [ + BotCommand("help", "Меню допомоги"), + BotCommand("balance", "Баланс картки"), + BotCommand("topup", "Поповнити картку"), + BotCommand("setcard", "Прив'язати картку"), + BotCommand("resetcard", "Відв'язати картку"), + ], + language_code="uk", + ) + + await self.set_bot_commands( + [ + BotCommand("help", "Меню допомоги"), + BotCommand("balance", "Баланс картки"), + BotCommand("topup", "Поповнити картку"), + BotCommand("setcard", "Прив'язати картку"), + BotCommand("resetcard", "Відв'язати картку"), + ], + language_code="ru", + ) + + await self.set_bot_commands( + [ + BotCommand("help", "Help menu"), + BotCommand("balance", "Card's balance"), + BotCommand("topup", "Refill card"), + BotCommand("setcard", "Link card"), + BotCommand("resetcard", "Unlink card"), + ] + ) + + await self.set_bot_commands( + [ + BotCommand("help", "Help menu"), + BotCommand("balance", "Card's balance"), + BotCommand("topup", "Refill card"), + BotCommand("setcard", "Link card"), + BotCommand("resetcard", "Unlink card"), + BotCommand("shutdown", "Turn off the bot"), + ], + scope=BotCommandScopeChat(chat_id=await config_get("owner_id")), + ) + async def stop(self): try: await self.send_message( diff --git a/plugins/register_commands.py b/plugins/register_commands.py deleted file mode 100644 index 05a384f..0000000 --- a/plugins/register_commands.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -import logging - -from libbot import config_get -from pyrogram import filters -from pyrogram.client import Client -from pyrogram.types import BotCommand, BotCommandScopeChat, Message - -logger = logging.getLogger(__name__) - - -@Client.on_message( - ~filters.scheduled & filters.command(["register_commands"], prefixes="/") # type: ignore -) -async def command_register_commands(app: Client, msg: Message): - if msg.from_user.id == await config_get("owner_id"): - app.set_bot_commands( - [ - BotCommand("help", "Меню допомоги"), - BotCommand("balance", "Баланс картки"), - BotCommand("topup", "Поповнити картку"), - BotCommand("setcard", "Прив'язати картку"), - BotCommand("resetcard", "Відв'язати картку"), - ], - language_code="uk", - ) # type: ignore - - app.set_bot_commands( - [ - BotCommand("help", "Меню допомоги"), - BotCommand("balance", "Баланс картки"), - BotCommand("topup", "Поповнити картку"), - BotCommand("setcard", "Прив'язати картку"), - BotCommand("resetcard", "Відв'язати картку"), - ], - language_code="ru", - ) # type: ignore - - app.set_bot_commands( - [ - BotCommand("help", "Help menu"), - BotCommand("balance", "Card's balance"), - BotCommand("topup", "Refill card"), - BotCommand("setcard", "Link card"), - BotCommand("resetcard", "Unlink card"), - ] - ) # type: ignore - - app.set_bot_commands( - [ - BotCommand("help", "Help menu"), - BotCommand("balance", "Card's balance"), - BotCommand("topup", "Refill card"), - BotCommand("setcard", "Link card"), - BotCommand("resetcard", "Unlink card"), - BotCommand("shutdown", "Turn off the bot"), - ], - scope=BotCommandScopeChat(chat_id=await config_get("owner_id")), - ) # type: ignore