40 lines
909 B
Python
40 lines
909 B
Python
|
from aiogram import Router
|
||
|
from aiogram.types import Message, BotCommandScopeChat
|
||
|
from aiogram.filters import Command
|
||
|
from aiogram.fsm.context import FSMContext
|
||
|
|
||
|
from core import bot
|
||
|
from templates import commands as tcommands
|
||
|
from config import ADMINS, commands
|
||
|
|
||
|
router = Router()
|
||
|
|
||
|
|
||
|
@router.message(Command("start"))
|
||
|
async def start_command(msg: Message, state: FSMContext):
|
||
|
"""
|
||
|
Ловит команду /start
|
||
|
:param msg: Message
|
||
|
:param state: FSMContext
|
||
|
:return:
|
||
|
"""
|
||
|
await msg.delete()
|
||
|
if not msg.from_user.id in ADMINS:
|
||
|
return
|
||
|
|
||
|
last_msg = await msg.answer(
|
||
|
text=tcommands.start_text,
|
||
|
reply_markup=await tcommands.start_ikb()
|
||
|
)
|
||
|
|
||
|
await state.update_data(
|
||
|
last_msg=last_msg
|
||
|
)
|
||
|
|
||
|
await bot.set_my_commands(
|
||
|
commands=commands,
|
||
|
scope=BotCommandScopeChat(
|
||
|
chat_id=msg.from_user.id
|
||
|
)
|
||
|
)
|