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/projects/search.py
2022-10-21 21:06:20 +03:00

26 lines
751 B
Python

from loguru import logger
from aiogram import types
from aiogram.dispatcher import FSMContext
from states.project import ProjectStates
from services.repositories import Repos, ProjectRepo
async def ask_for_project_name(message: types.Message, state: FSMContext):
await state.set_state(ProjectStates.search)
await message.answer("Введите название проекта")
async def search_for_projects(
message: types.Message, state: FSMContext, repo: Repos
):
await state.reset_state()
projects = await repo.get_repo(ProjectRepo).get(message.text)
for project in projects:
await message.answer(
f"<b>{project['name']}</b>\n\n {project['description']}",
parse_mode="html"
)