This repository has been archived on 2022-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
it-volunteers-for-peace/handlers/commands.py
2022-10-17 14:58:17 +04:00

31 lines
1.1 KiB
Python

from loguru import logger
from aiogram import types, Dispatcher
from keyboards.default import default_kb
from services.repositories import Repos, UserRepo
async def start(message: types.Message, repo: Repos):
user = await repo.get_repo(UserRepo).get(message.from_user.id)
if user is not None:
await message.answer(
"Добро пожаловать в Бота Теплицы Социальных Технологий "
"для организации антивоенных проектов.",
reply_markup=default_kb,
)
async def request_invite(message: types.Message, repo: Repos):
await repo.get_repo(UserRepo).add(message.from_user.id, message.chat.id)
logger.debug(f"Added new user {message.from_user.full_name}")
bot_info = await message.bot.get_me()
await message.reply(
f"Чтобы создать Ваш проект, перейдите в лс к боту @{bot_info.username}"
)
def register_command_handlers(dp: Dispatcher):
dp.register_message_handler(start, commands="start")
dp.register_message_handler(request_invite, commands="inviteme")