Add button to join the project

This commit is contained in:
LoRiot 2022-10-22 18:22:34 +03:00
parent 2a85be2f6f
commit 4b5a42d254
2 changed files with 17 additions and 1 deletions

View file

@ -3,6 +3,8 @@ from loguru import logger
from aiogram import types from aiogram import types
from aiogram.dispatcher import FSMContext from aiogram.dispatcher import FSMContext
from keyboards.inline import get_join_project_kb
from states.project import ProjectStates from states.project import ProjectStates
from services.repositories import Repos, ProjectRepo, UserRepo from services.repositories import Repos, ProjectRepo, UserRepo
@ -24,5 +26,6 @@ async def search_for_projects(
for project in projects: for project in projects:
await message.answer( await message.answer(
f"<b>{project['name']}</b>\n\n {project['description']}", f"<b>{project['name']}</b>\n\n {project['description']}",
parse_mode="html" reply_markup=get_join_project_kb(project["id"]),
parse_mode="html",
) )

13
keyboards/inline.py Normal file
View file

@ -0,0 +1,13 @@
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
def get_join_project_kb(project_id: int) -> InlineKeyboardMarkup:
return InlineKeyboardMarkup(
inline_keyboard=[
[
InlineKeyboardButton(
"Присоединиться 💚", callback_data=str(project_id)
),
],
]
)