This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
BWTAqua/plugins/register_commands.py
2023-05-16 20:50:18 +02:00

61 lines
2.2 KiB
Python

# -*- 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