Skip to content

Commit

Permalink
feat: auto-split /broadcast result message
Browse files Browse the repository at this point in the history
  • Loading branch information
F33RNI committed Apr 5, 2024
1 parent 77ee1fb commit e22db60
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions bot_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,13 +1240,18 @@ async def bot_command_broadcast(self, update: Update, context: ContextTypes.DEFA
except Exception as e:
logging.warning(f"Error sending message to {broadcast_user_id}", exc_info=e)

# Send final message with list of users
await _send_safe(
user_id,
self.messages.get_message("broadcast_done", lang_id=lang_id).format(
broadcast_ok_users="\n".join(broadcast_ok_users)
),
context,
# Send list of users with auto-splitting
message = self.messages.get_message("broadcast_done", lang_id=lang_id).format(
broadcast_ok_users="\n".join(broadcast_ok_users)
)
request_response = request_response_container.RequestResponseContainer(
user_id=user_id,
reply_message_id=update.effective_message.id,
module_name="",
response_text=message,
)
await bot_sender.send_message_async(
self.config.get("telegram"), self.messages, request_response, end=True, plain_text=True
)

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

0 comments on commit e22db60

Please sign in to comment.