Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/pycamp_bot/commands/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,23 @@ async def delete_project(update, context):
async def show_projects(update, context):
"""Show available projects"""
projects = Project.select()
PROJECT_FIELDS = [
'*{}*',
'Owner: @{}',
'Temática: {}',
'Nivel: {}',
'Repositorio: {}',
'Grupo de Telegram: {}',
]
text = []
for project in projects:
project_text = "{}\n Owner: @{}\n Temática: {}\n Nivel: {}\n Repositorio: {}\n Grupo de Telegram: {}".format(
project.name,
project.owner.username,
project.topic,
project_text = '\n'.join(PROJECT_FIELDS).format(
escape_markdown(project.name),
escape_markdown(project.owner.username),
escape_markdown(project.topic),
DIFFICULTY_LEVEL_NAMES[project.difficult_level],
project.repository_url or '(ninguno)',
project.group_url or '(ninguno)',
escape_markdown(project.repository_url or '(ninguno)'),
escape_markdown(project.group_url or '(ninguno)'),
)
participants_count = Vote.select().where(
(Vote.project == project) & (Vote.interest)).count()
Expand All @@ -473,7 +481,11 @@ async def show_projects(update, context):
else:
text = "Todavía no hay ningún proyecto cargado"

await update.message.reply_text(text, link_preview_options=LinkPreviewOptions(is_disabled=True))
await update.message.reply_text(
text,
parse_mode='MarkdownV2',
link_preview_options=LinkPreviewOptions(is_disabled=True),
)



Expand Down