Skip to content

fix: ephemeral messages default time, typo#74

Merged
lorenzocorallo merged 7 commits intomainfrom
fix-ephemeral
Apr 11, 2026
Merged

fix: ephemeral messages default time, typo#74
lorenzocorallo merged 7 commits intomainfrom
fix-ephemeral

Conversation

@toto04
Copy link
Copy Markdown
Contributor

@toto04 toto04 commented Apr 10, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd9d6cd7-9b63-4498-8f69-21b88f79c2ae

📥 Commits

Reviewing files that changed from the base of the PR and between 0aa4160 and e3dfec7.

📒 Files selected for processing (2)
  • src/commands/moderation/ban.ts
  • src/utils/messages.ts
✅ Files skipped from review due to trivial changes (2)
  • src/utils/messages.ts
  • src/commands/moderation/ban.ts

Walkthrough

Removed 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

Cohort / File(s) Summary
Grants message flow
src/commands/management/grants.ts
Removed post-cancel wait and message deletion; cancel handler now edits the message, closes the menu, and stops the conversation.
Moderation unban flow
src/commands/moderation/ban.ts
Replaced non-ephemeral failure replies + wait+delete with ephemeral replies; adjusted message formatting for one failure branch; removed unused wait import.
Ephemeral default timeout
src/utils/messages.ts
Changed ephemeral default timeout from 500020000 ms (JSDoc and parameter initializer).
Metadata/text fix
src/commands/moderation/banall.ts
Fixed command description text: "PREMA BAN" → "PERMA BAN".

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title mentions both the main change (ephemeral messages default time) and a secondary fix (typo in ban_all description), accurately reflecting the pull request's objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e614937 and 36b8847.

📒 Files selected for processing (5)
  • src/commands/management/grants.ts
  • src/commands/moderation/ban.ts
  • src/commands/moderation/banall.ts
  • src/commands/moderation/mute.ts
  • src/utils/messages.ts
💤 Files with no reviewable changes (2)
  • src/commands/moderation/mute.ts
  • src/commands/management/grants.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/commands/moderation/ban.ts (1)

83-97: ⚠️ Potential issue | 🟠 Major

Avoid 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

📥 Commits

Reviewing files that changed from the base of the PR and between 36b8847 and 004734a.

📒 Files selected for processing (2)
  • src/commands/moderation/ban.ts
  • src/commands/moderation/banall.ts
✅ Files skipped from review due to trivial changes (1)
  • src/commands/moderation/banall.ts

sono stupido
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/commands/moderation/ban.ts (1)

85-85: ⚠️ Potential issue | 🟠 Major

Do not await ephemeral error replies in unban failure 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"))
         return

Also 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

📥 Commits

Reviewing files that changed from the base of the PR and between 004734a and 0aa4160.

📒 Files selected for processing (1)
  • src/commands/moderation/ban.ts

@lorenzocorallo lorenzocorallo enabled auto-merge (squash) April 11, 2026 14:14
@lorenzocorallo lorenzocorallo merged commit 7bcc36f into main Apr 11, 2026
2 checks passed
@lorenzocorallo lorenzocorallo deleted the fix-ephemeral branch April 11, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants