Skip to content

hotfix: await all command interactions, handle empty response from OpenAI#73

Merged
lorenzocorallo merged 2 commits intomainfrom
hotfix
Apr 10, 2026
Merged

hotfix: await all command interactions, handle empty response from OpenAI#73
lorenzocorallo merged 2 commits intomainfrom
hotfix

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

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR standardizes async operation handling across command handlers and middleware by consistently awaiting previously fire-and-forget async operations. Changes affect error response ephemeral replies, message deletion flows, and promise handling in command validation paths.

Changes

Cohort / File(s) Summary
Moderation Commands
src/commands/moderation/ban.ts, src/commands/moderation/del.ts, src/commands/moderation/kick.ts, src/commands/moderation/mute.ts
Converted fire-and-forget void ephemeral(context.reply(...)) calls to awaited operations in error-handling paths. Additionally, in ban.ts and mute.ts, message deletion promises changed from detached void wait(5000).then(() => msg.delete()) to await wait(5000).then(() => msg.delete()).
Command Handlers
src/commands/index.ts, src/commands/link-admin-dashboard.ts, src/commands/management/groups.ts
Updated async control flow to await ephemeral reply and message deletion operations. In link-admin-dashboard.ts, replaced timed message deletion with await ephemeral(msg) helper. In management/groups.ts, converted early-return reply patterns from return void context.reply(...) to await context.reply(...) followed by return.
AI Moderation Middleware
src/middlewares/auto-moderation-stack/ai-moderation.ts
Added early return guard in parseFlaggedCategories to prevent array access on empty results.

Possibly related PRs

  • PoliNetworkOrg/telegram#66: Modifies the same command handlers (ban, del, kick, mute) with similar changes to await async reply and message deletion behaviors in error paths.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: converting fire-and-forget async calls to awaited ones across command handlers, and adding an empty-array guard in the AI moderation parser.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

@toto04 toto04 requested a review from lorenzocorallo April 10, 2026 15:16
@lorenzocorallo lorenzocorallo merged commit b68c166 into main Apr 10, 2026
1 of 2 checks passed
@lorenzocorallo lorenzocorallo deleted the hotfix branch April 10, 2026 15:16
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