Add /create_project command handler
This commit is contained in:
parent
4356eada3c
commit
5e9390324a
6
bot.py
6
bot.py
|
@ -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
12
handlers/commands.py
Normal 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")
|
Reference in a new issue