44from pycamp_bot .commands .auth import get_admins_username
55from pycamp_bot .logger import logger
66from pycamp_bot .commands .manage_pycamp import active_needed
7+ from pycamp_bot .utils import escape_markdown
78
89PROYECTO , LUGAR , MENSAJE = ["proyecto" , "lugar" , "mensaje" ]
910
@@ -78,8 +79,8 @@ async def announce(update: Update, context: CallbackContext) -> str:
7879 if len (_projects ) == 0 :
7980 await context .bot .send_message (
8081 chat_id = update .message .chat_id ,
81- text = f"No existe el proyecto: *{ state .p_name } *." ,
82- parse_mode = 'Markdown '
82+ text = f"No existe el proyecto: *{ escape_markdown ( state .p_name ) } *." ,
83+ parse_mode = 'MarkdownV2 '
8384 )
8485 return ConversationHandler .END
8586 elif not await should_be_able_to_announce (state .username , _projects [0 ]):
@@ -92,8 +93,8 @@ async def announce(update: Update, context: CallbackContext) -> str:
9293 else :
9394 await context .bot .send_message (
9495 chat_id = update .message .chat_id ,
95- text = f"Anunciando el proyecto: *{ _projects [0 ].name .capitalize ()} * !!!" ,
96- parse_mode = 'Markdown '
96+ text = f"Anunciando el proyecto: *{ escape_markdown ( _projects [0 ].name ) .capitalize ()} * !!!" ,
97+ parse_mode = 'MarkdownV2 '
9798 )
9899 state .owner = _projects [0 ].owner .username
99100 state .current_project = _projects [0 ]
@@ -184,20 +185,20 @@ async def message_project(update: Update, context: CallbackContext) -> str:
184185 try :
185186 await context .bot .send_message (
186187 chat_id = chat_id ,
187- text = f'''Está por empezar el proyecto *"{ (state .p_name ).capitalize ()} "* a cargo de *@{ state .owner } *.\n *¿Dónde?* 👉🏼 { state .lugar } ''' ,
188- parse_mode = 'Markdown '
188+ text = f'''Está por empezar el proyecto *"{ escape_markdown (state .p_name ).capitalize ()} "* a cargo de *@{ escape_markdown ( state .owner ) } *.\n *¿Dónde?* 👉🏼 { escape_markdown ( state .lugar ) } ''' ,
189+ parse_mode = 'MarkdownV2 '
189190 )
190191 if update .message .from_user .username == state .owner :
191192 await context .bot .send_message (
192193 chat_id = chat_id ,
193- text = f'*Project Owner says:* **{ state .mensaje } **' ,
194- parse_mode = 'Markdown '
194+ text = f'*Project Owner says:* **{ escape_markdown ( state .mensaje ) } **' ,
195+ parse_mode = 'MarkdownV2 '
195196 )
196197 else :
197198 await context .bot .send_message (
198199 chat_id = chat_id ,
199- text = f'Admin *@{ update .message .from_user .username } * says: **{ state .mensaje } **' ,
200- parse_mode = 'Markdown '
200+ text = f'Admin *@{ escape_markdown ( update .message .from_user .username ) } * says: **{ escape_markdown ( state .mensaje ) } **' ,
201+ parse_mode = 'MarkdownV2 '
201202 )
202203 except Exception as e :
203204 logger .error (f"Error al enviar el mensaje: { e } " )
0 commit comments