Skip to content

Commit e22db60

Browse files
committed
feat: auto-split /broadcast result message
1 parent 77ee1fb commit e22db60

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

bot_handler.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -1240,13 +1240,18 @@ async def bot_command_broadcast(self, update: Update, context: ContextTypes.DEFA
12401240
except Exception as e:
12411241
logging.warning(f"Error sending message to {broadcast_user_id}", exc_info=e)
12421242

1243-
# Send final message with list of users
1244-
await _send_safe(
1245-
user_id,
1246-
self.messages.get_message("broadcast_done", lang_id=lang_id).format(
1247-
broadcast_ok_users="\n".join(broadcast_ok_users)
1248-
),
1249-
context,
1243+
# Send list of users with auto-splitting
1244+
message = self.messages.get_message("broadcast_done", lang_id=lang_id).format(
1245+
broadcast_ok_users="\n".join(broadcast_ok_users)
1246+
)
1247+
request_response = request_response_container.RequestResponseContainer(
1248+
user_id=user_id,
1249+
reply_message_id=update.effective_message.id,
1250+
module_name="",
1251+
response_text=message,
1252+
)
1253+
await bot_sender.send_message_async(
1254+
self.config.get("telegram"), self.messages, request_response, end=True, plain_text=True
12501255
)
12511256

12521257
async def bot_command_module(self, update: Update, context: ContextTypes.DEFAULT_TYPE):

0 commit comments

Comments
 (0)