This commit is contained in:
2026-01-01 23:14:56 +03:00
parent ead8fbe1a0
commit cfc4467b56
8 changed files with 90 additions and 12 deletions
@@ -0,0 +1,32 @@
from aiogram import Bot
from aiogram.types import BotCommand, BotCommandScopeAllPrivateChats, BotCommandScopeChat
from trudex.infrastructure.database.repo.user import UserRepository
from trudex.infrastructure.utils.config import Config
async def setup_bot_commands(bot: Bot, config: Config, user_repo: UserRepository) -> None:
await bot.set_my_commands(
commands=[
BotCommand(command="start", description="Главное меню"),
],
scope=BotCommandScopeAllPrivateChats(),
)
admins = await user_repo.get_admins()
for admin in admins:
await bot.set_my_commands(
commands=[
BotCommand(command="start", description="Главное меню"),
BotCommand(command="admin", description="Админ-панель"),
],
scope=BotCommandScopeChat(chat_id=admin.id),
)
await bot.set_my_commands(
commands=[
BotCommand(command="start", description="Главное меню"),
BotCommand(command="creator", description="Панель создателя"),
],
scope=BotCommandScopeChat(chat_id=config.bot.creator_id),
)