@@ -128,7 +128,8 @@ def send_template(c: CallbackQuery):
128128 split [5 :])
129129
130130 if template_index > len (tg .answer_templates ) - 1 :
131- bot .send_message (c .message .chat .id , _ ("tmplt_not_found_err" , template_index ))
131+ bot .send_message (c .message .chat .id , _ ("tmplt_not_found_err" , template_index ),
132+ message_thread_id = c .message .message_thread_id )
132133 if prev_page == 0 :
133134 bot .edit_message_reply_markup (c .message .chat .id , c .message .id ,
134135 reply_markup = keyboards .reply (node_id , username ))
@@ -144,12 +145,16 @@ def send_template(c: CallbackQuery):
144145
145146 text = tg .answer_templates [template_index ].replace ("$username" , safe_text (username ))
146147 result = cardinal .send_message (node_id , text , username )
147- if result :
148- bot .send_message (c .message .chat .id , _ ("tmplt_msg_sent" , node_id , username , utils .escape (text )),
149- reply_markup = keyboards .reply (node_id , username , again = True , extend = True ))
148+
149+ if prev_page == 3 :
150+ bot .answer_callback_query (c .id , _ ("msg_sent_short" ) if result else _ ("msg_sending_error_short" ))
151+ return
150152 else :
151- bot .send_message (c .message .chat .id , _ ("msg_sending_error" , node_id , username ),
152- reply_markup = keyboards .reply (node_id , username , again = True , extend = True ))
153+ msg_text = _ ("tmplt_msg_sent" , node_id , username , utils .escape (text )) if result else \
154+ _ ("msg_sending_error" , node_id , username )
155+ bot .send_message (c .message .chat .id , msg_text ,
156+ reply_markup = keyboards .reply (node_id , username , again = True , extend = True ),
157+ message_thread_id = c .message .message_thread_id )
153158 bot .answer_callback_query (c .id )
154159
155160 tg .cbq_handler (open_templates_list , lambda c : c .data .startswith (f"{ CBT .TMPLT_LIST } :" ))
0 commit comments