Add /broadcast command for admin mass messaging#17
Merged
Conversation
Boss-only wizard: capture any message type, confirm user count, then copy to every user via copyMessage with per-user try/catch, 50ms rate-limit delay, and a final delivery report (count + percentage + failed user list).
- Add "Test (only me)" button — sends to boss only, stays on same step so you can test repeatedly before confirming - Deduplicate user IDs before broadcast (User.id is not unique in DB) - Escape HTML in error messages to avoid breaking Telegram's parser - Wrap final report send in try/catch so a Telegram hiccup doesn't lose the scene - Use editMessageText instead of new messages — cleaner UX, removes stale inline keyboards - answerCbQuery on every button press to dismiss Telegram spinner - Store userCount in wizard state to avoid re-querying on test sends
- Add state.broadcastRunning lock — second click on "Send to all" returns early with a toast instead of starting a duplicate broadcast - Refactor executeBroadcast to accept options object (delayMs, onProgress) instead of positional delayMs arg - Add onProgress callback — scene sends ~4 progress messages during long broadcasts (adaptive interval: max(100, total/4)) - onProgress errors are silently swallowed to never abort the run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/broadcastcommand — sends a message to all bot usersFiles
src/commands/broadcast/— command, scenes, utils, constantssrc/app.ts— register command + scenelocales/ru.yaml,locales/en.yaml— i18n keysTest plan
npm run buildpassesnpx jest)/broadcastas BOSS_TG_ID, verify wizard flow and delivery report