@@ -452,7 +452,11 @@ async def delete_project(update, context):
452452async def show_projects (update , context ):
453453 """Show available projects"""
454454 projects = Project .select ()
455- text = []
455+ if not projects :
456+ msg_text = "Todavía no hay ningún proyecto cargado"
457+ await update .message .reply_text (msg_text , link_preview_options = LinkPreviewOptions (is_disabled = True ))
458+
459+ msg_text = ""
456460 for project in projects :
457461 project_text = "{}\n Owner: @{}\n Temática: {}\n Nivel: {}\n Repositorio: {}\n Grupo de Telegram: {}" .format (
458462 project .name ,
@@ -466,15 +470,15 @@ async def show_projects(update, context):
466470 (Vote .project == project ) & (Vote .interest )).count ()
467471 if participants_count > 0 :
468472 project_text += "\n Interesades: {}" .format (participants_count )
469- text .append (project_text )
470473
471- if text :
472- text = "\n \n " .join (text )
473- else :
474- text = "Todavía no hay ningún proyecto cargado"
474+ if len (msg_text ) + len (project_text ) > 4096 :
475+ await update .message .reply_text (msg_text , link_preview_options = LinkPreviewOptions (is_disabled = True ))
476+ msg_text = ""
475477
476- await update . message . reply_text ( text , link_preview_options = LinkPreviewOptions ( is_disabled = True ))
478+ msg_text += " \n \n " + project_text
477479
480+ if msg_text :
481+ await update .message .reply_text (msg_text , link_preview_options = LinkPreviewOptions (is_disabled = True ))
478482
479483
480484async def show_participants (update , context ):
0 commit comments