Add /create_project command handler

This commit is contained in:
LoRiot 2022-10-15 18:51:27 +03:00
parent 4356eada3c
commit 5e9390324a
2 changed files with 17 additions and 1 deletions

6
bot.py
View file

@ -1,9 +1,10 @@
#!/usr/bin/python
import logging
import os
import asyncio
from aiogram import Bot, Dispatcher
from handlers.commands import register_command_handlers
async def main():
@ -14,6 +15,9 @@ async def main():
bot = Bot(API_TOKEN)
dp = Dispatcher(bot)
# Register handlers
register_command_handlers(dp)
try:
await dp.start_polling()
finally:

12
handlers/commands.py Normal file
View file

@ -0,0 +1,12 @@
from aiogram import types, Dispatcher
async def create_project(message: types.Message):
bot_info = await message.bot.get_me()
await message.reply(
f"Перейдите в лс к боту @{bot_info.username}"
)
def register_command_handlers(dp: Dispatcher):
dp.register_message_handler(create_project, commands="create_project")