fix: ephemeral messages default time, typo#74
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
WalkthroughRemoved short delay + message-deletion flows and replaced those reply flows with edits or ephemeral replies; adjusted the default ephemeral timeout from 5000ms to 20000ms; fixed a typo in the ban-all command description. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/moderation/ban.ts`:
- Around line 82-90: The ephemeral reply calls in the error paths (the
ephemeral(context.reply(...)) around the user-not-found and getUser failure
branches) are being awaited which keeps the handler open; change those to
fire-and-forget by removing the await (or prefix with void) so you call
ephemeral(context.reply(...)) without awaiting it, keep the existing
logger.error and immediate return behavior, and leave the rest of the ban
command (getUser, logger.error, context.reply) unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5ffe2358-9ff3-4482-95a7-10e172edeeed
📒 Files selected for processing (5)
src/commands/management/grants.tssrc/commands/moderation/ban.tssrc/commands/moderation/banall.tssrc/commands/moderation/mute.tssrc/utils/messages.ts
💤 Files with no reviewable changes (2)
- src/commands/moderation/mute.ts
- src/commands/management/grants.ts
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/commands/moderation/ban.ts (1)
83-97:⚠️ Potential issue | 🟠 MajorAvoid awaiting
ephemeral()on these early returns.Line 85 and Line 96 now wait for the full ephemeral timeout before the handler finishes. That turns a quick error path into a ~30s pending command. Fire-and-forget these replies instead.
Proposed fix
- await ephemeral(context.reply(fmt(({ b }) => b`@${context.from.username} user not found`))) + void ephemeral(context.reply(fmt(({ b }) => b`@${context.from.username} user not found`))) return } @@ logger.error({ userId }, "UNBAN: cannot retrieve the user") - await ephemeral(context.reply("Error: cannot find this user")) + void ephemeral(context.reply("Error: cannot find this user")) return }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/moderation/ban.ts` around lines 83 - 97, The fast-error paths in unban currently await ephemeral(...) which blocks the handler for the ephemeral timeout; remove the await so replies are fire-and-forget. Specifically, in the branches that handle missing userId and missing user (around getUser and the unban flow), replace awaited calls like await ephemeral(context.reply(...)) with a non-awaited call ephemeral(context.reply(...)) (do not await or assign the returned promise), keep the logger.error/debug calls and immediate return so the handler exits without waiting for the ephemeral timeout.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/moderation/ban.ts`:
- Around line 91-96: Remove the leftover merge conflict markers (<<<<<<<,
=======, >>>>>>>) in the ban handler and keep a single coherent branch: either
use the awaited reply assigned to msg (const msg = await context.reply(fmt(({ n
}) => n`Error: cannot find this user`))) or keep the existing ephemeral reply
call (await ephemeral(context.reply("Error: cannot find this user"))), but do
not keep both/markers; ensure logger.error({ userId }, "UNBAN: cannot retrieve
the user") remains and that any removed/kept variables (msg) are used or removed
to avoid unused-variable errors, and verify the file parses cleanly so tsc no
longer reports TS1185.
---
Duplicate comments:
In `@src/commands/moderation/ban.ts`:
- Around line 83-97: The fast-error paths in unban currently await
ephemeral(...) which blocks the handler for the ephemeral timeout; remove the
await so replies are fire-and-forget. Specifically, in the branches that handle
missing userId and missing user (around getUser and the unban flow), replace
awaited calls like await ephemeral(context.reply(...)) with a non-awaited call
ephemeral(context.reply(...)) (do not await or assign the returned promise),
keep the logger.error/debug calls and immediate return so the handler exits
without waiting for the ephemeral timeout.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c01e90a7-c45c-4867-ac4b-e852866082e9
📒 Files selected for processing (2)
src/commands/moderation/ban.tssrc/commands/moderation/banall.ts
✅ Files skipped from review due to trivial changes (1)
- src/commands/moderation/banall.ts
sono stupido
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/commands/moderation/ban.ts (1)
85-85:⚠️ Potential issue | 🟠 MajorDo not await ephemeral error replies in
unbanfailure paths.At Line 85 and Line 92,
await ephemeral(...)keeps the handler open until the default 30s timeout elapses. Fire-and-forget these calls to avoid unnecessary handler blocking.Proposed fix
- await ephemeral(context.reply(fmt(({ b }) => b`@${context.from.username} user not found`))) + void ephemeral(context.reply(fmt(({ b }) => b`@${context.from.username} user not found`))) return ... - await ephemeral(context.reply("Error: cannot find this user")) + void ephemeral(context.reply("Error: cannot find this user")) returnAlso applies to: 92-92
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/moderation/ban.ts` at line 85, The ephemeral error reply calls in the unban failure paths (the calls using ephemeral(context.reply(...)) in the unban/ban handler) are being awaited which keeps the handler open; remove the await and make them fire-and-forget (e.g., call ephemeral(...) without awaiting or prefix with void) so the handler can return immediately when user-not-found/unban-failure branches execute; change the two occurrences around the unban failure paths where ephemeral(context.reply(fmt(({ b }) => b`@${context.from.username} user not found`))) and the similar message at the other branch to non-awaited calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/commands/moderation/ban.ts`:
- Line 85: The ephemeral error reply calls in the unban failure paths (the calls
using ephemeral(context.reply(...)) in the unban/ban handler) are being awaited
which keeps the handler open; remove the await and make them fire-and-forget
(e.g., call ephemeral(...) without awaiting or prefix with void) so the handler
can return immediately when user-not-found/unban-failure branches execute;
change the two occurrences around the unban failure paths where
ephemeral(context.reply(fmt(({ b }) => b`@${context.from.username} user not
found`))) and the similar message at the other branch to non-awaited calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8add954b-1fc4-4884-8494-9d3727feed3e
📒 Files selected for processing (1)
src/commands/moderation/ban.ts
No description provided.