61 lines
2.2 KiB
Python
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
|