Files
Bot-Template/tgbot/utils/misc/bot_commands.py
T
2025-10-10 07:06:23 +03:00

31 lines
951 B
Python

# - *- coding: utf- 8 - *-
from aiogram import Bot
from aiogram.types import BotCommand, BotCommandScopeChat, BotCommandScopeDefault
from tgbot.data.config import get_admins
# Commands for users
user_commands = [
BotCommand(command="start", description="♻️ Restart bot"),
BotCommand(command="menu", description="🌀 Get keyboards"),
]
# Commands for admins
admin_commands = [
BotCommand(command="start", description="♻️ Restart bot"),
BotCommand(command="menu", description="🌀 Get keyboards"),
BotCommand(command="log", description="🖨 Get Logs"),
BotCommand(command="db", description="📦 Get Database"),
]
# Set commands
async def set_commands(bot: Bot):
await bot.set_my_commands(user_commands, scope=BotCommandScopeDefault())
for admin in get_admins():
try:
await bot.set_my_commands(admin_commands, scope=BotCommandScopeChat(chat_id=admin))
except:
...