/start command handler
This commit is contained in:
parent
474efbf43f
commit
e03a4da8c7
|
@ -4,6 +4,15 @@ from aiogram import types, Dispatcher
|
||||||
from services.repository import Repo
|
from services.repository import Repo
|
||||||
|
|
||||||
|
|
||||||
|
async def start(message: types.Message, repo: Repo):
|
||||||
|
user = await repo.get_user(message.from_user.id)
|
||||||
|
if user is not None:
|
||||||
|
await message.answer(
|
||||||
|
"Добро пожаловать в Бота Теплицы Социальных Технологий "
|
||||||
|
"для организации антивоенных проектов."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def request_invite(message: types.Message, repo: Repo):
|
async def request_invite(message: types.Message, repo: Repo):
|
||||||
await repo.add_user(message.from_user.id, message.chat.id)
|
await repo.add_user(message.from_user.id, message.chat.id)
|
||||||
logger.debug(f"Added new user {message.from_user.full_name}")
|
logger.debug(f"Added new user {message.from_user.full_name}")
|
||||||
|
@ -15,4 +24,5 @@ async def request_invite(message: types.Message, repo: Repo):
|
||||||
|
|
||||||
|
|
||||||
def register_command_handlers(dp: Dispatcher):
|
def register_command_handlers(dp: Dispatcher):
|
||||||
|
dp.register_message_handler(start, commands="start")
|
||||||
dp.register_message_handler(request_invite, commands="inviteme")
|
dp.register_message_handler(request_invite, commands="inviteme")
|
||||||
|
|
Reference in a new issue