Discord: implement stream preview mode#22111
Merged
thewilloftheshadow merged 4 commits intomainfrom Feb 20, 2026
Merged
Conversation
Comment on lines
+774
to
+795
| if (canFinalizeViaPreviewEdit) { | ||
| await draftStream.stop(); | ||
| try { | ||
| await editMessageDiscord( | ||
| deliverChannelId, | ||
| previewMessageId, | ||
| { content: previewFinalText }, | ||
| { rest: client.rest }, | ||
| ); | ||
| finalizedViaPreviewMessage = true; | ||
| replyReference.markSent(); | ||
| return; | ||
| } catch (err) { | ||
| logVerbose( | ||
| `discord: preview final edit failed; falling back to standard send (${String(err)})`, | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| // Check if stop() flushed a message we can edit | ||
| if (!finalizedViaPreviewMessage) { | ||
| await draftStream.stop(); |
Contributor
There was a problem hiding this comment.
stop() called twice in sequence
The first attempt calls await draftStream.stop() on line 775. If that attempt fails to edit, the code calls await draftStream.stop() again on line 795. Since stop() sets isFinal = true and flushes, the second call would be a no-op (stopped is already true from first stop). Consider restructuring to only call stop() once before attempting edits.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/discord/monitor/message-handler.process.ts
Line: 774-795
Comment:
`stop()` called twice in sequence
The first attempt calls `await draftStream.stop()` on line 775. If that attempt fails to edit, the code calls `await draftStream.stop()` again on line 795. Since `stop()` sets `isFinal = true` and flushes, the second call would be a no-op (stopped is already true from first stop). Consider restructuring to only call `stop()` once before attempting edits.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
rodrigogs
pushed a commit
to rodrigogs/openclaw
that referenced
this pull request
Feb 20, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
Hansen1018
added a commit
to Hansen1018/openclaw
that referenced
this pull request
Feb 21, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
vincentkoc
pushed a commit
that referenced
this pull request
Feb 21, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
4 tasks
dgarson
pushed a commit
to dgarson/clawdbot
that referenced
this pull request
Feb 21, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
mmyyfirstb
pushed a commit
to mmyyfirstb/openclaw
that referenced
this pull request
Feb 21, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
obviyus
pushed a commit
to guirguispierre/openclaw
that referenced
this pull request
Feb 22, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
mreedr
pushed a commit
to mreedr/openclaw-custom
that referenced
this pull request
Feb 24, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
* Discord: implement stream preview mode * Changelog: note Discord stream preview mode * Tests: type discord draft stream mocks * Docs: document Discord stream preview
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.
Greptile Summary
Implements live stream preview mode for Discord replies with
partialandblockstreaming options, mirroring the existing Telegram implementation.streamModeconfig (off|partial|block) with draft chunking supportcreateDiscordDraftStreamConfidence Score: 4/5
stop()call found but doesn't impact functionality.stop()calls that could be refactoredLast reviewed commit: 7e366a5