@@ -53,9 +53,9 @@ async def naming_project(update, context):
5353 '''Dialog to set project name'''
5454 logger .info ("Nombrando el proyecto" )
5555 username = update .message .from_user .username
56- text = update .message .text . lower ()
56+ name = update .message .text
5757
58- new_project = Project (name = text )
58+ new_project = Project (name = name )
5959 current_projects [username ] = new_project
6060
6161 await context .bot .send_message (
@@ -64,7 +64,7 @@ async def naming_project(update, context):
6464 )
6565 await context .bot .send_message (
6666 chat_id = update .message .chat_id ,
67- text = "Tu proyecto se llama: {}" .format (text . title () )
67+ text = "Tu proyecto se llama: {}" .format (name )
6868 )
6969 await context .bot .send_message (
7070 chat_id = update .message .chat_id ,
@@ -103,8 +103,7 @@ async def project_level(update, context):
103103 else :
104104 await context .bot .send_message (
105105 chat_id = update .message .chat_id ,
106- text = "Nooooooo input no válido, por favor "
107- "ingresá 1, 2 o 3" .format (text )
106+ text = "Nooooooo input no válido, por favor ingresá 1, 2 o 3"
108107 )
109108 return DIFICULTAD
110109
@@ -135,7 +134,7 @@ async def project_topic(update, context):
135134 text = "Excelente {}! La temática de tu proyecto es: {}." .format (username , text ))
136135 await context .bot .send_message (
137136 chat_id = update .message .chat_id ,
138- text = "Tu proyecto ha sido cargado" . format ( username , text )
137+ text = "Tu proyecto ha sido cargado"
139138 )
140139 return ConversationHandler .END
141140
@@ -198,22 +197,24 @@ async def delete_project(update, context):
198197 if len (project_name_splited ) < 2 :
199198 await context .bot .send_message (
200199 chat_id = update .message .chat_id ,
201- text = "Debes ingresar el nombre de proyecto a eliminar. \n Ej: /borrar_proyecto intro django."
200+ text = (
201+ "Debes ingresar el nombre de proyecto a eliminar.\n "
202+ "Ej: /borrar_proyecto intro django."
203+ )
202204 )
203205 return
204206 else :
205207 try :
206208 project_name = ' ' .join (project_name_lower [1 :])
207209 project = Project .select ().where (Project .name == project_name ).get ()
208- except :
210+ except Exception :
209211 await context .bot .send_message (
210212 chat_id = update .message .chat_id ,
211213 text = "No se encontró el proyecto '{}'." .format (project_name )
212214 )
213215 return
214216
215-
216- if username != project .owner .username and username not in get_admins_username ():
217+ if username != project .owner .username and username not in get_admins_username ():
217218 await context .bot .send_message (
218219 chat_id = update .message .chat_id ,
219220 text = "No sos ni admin ni el owner de este proyecto, Careta."
@@ -239,8 +240,8 @@ async def show_projects(update, context):
239240 project .topic ,
240241 project .difficult_level
241242 )
242- participants_count = Vote .select ().where (( Vote . project == project )
243- & (Vote .interest )).count ()
243+ participants_count = Vote .select ().where (
244+ ( Vote . project == project ) & (Vote .interest )).count ()
244245 if participants_count > 0 :
245246 project_text += "\n Interesades: {}" .format (participants_count )
246247 text .append (project_text )
@@ -263,4 +264,3 @@ def set_handlers(application):
263264 CommandHandler ('borrar_proyecto' , delete_project ))
264265 application .add_handler (
265266 CommandHandler ('proyectos' , show_projects ))
266-
0 commit comments