Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

fix: defer slash commands that can outlast Discord's 3-second window - #127

Merged
rnxm merged 1 commit into
devfrom
fix/defer-heavy-commands
Nov 12, 2026
Merged

rnxm merged 1 commit into
devfrom
fix/defer-heavy-commands

Conversation

@rnxm

@rnxm rnxm commented Nov 12, 2026

Copy link
Copy Markdown
Member

Why

Nothing defers slash commands automatically. The old before_invoke hook never ran, as found in #118. So any command that does slow work before its first reply fails with "The application did not respond" after 3 seconds.

What

These commands now call ctx.defer() first. It does nothing for prefix commands.

Command Slow part
level renders the rank card image
snapshot reads every role and channel
snapshot load recreates roles and channels
voice play connects to voice and searches Lavalink
info ip calls ipinfo.io
info template fetches the template from Discord

The defer is public, so these replies stay public, which matches what they send today. The GLOSSARY.md decision on message visibility now lists them.

Tests

  • New test: level defers once it has a guild, and doesn't defer in DMs.
  • ruff format --check, ruff check, ty check and pytest all pass (367 passed).

🤖 Generated with Claude Code

Nothing defers slash commands automatically (the old before_invoke hook
never ran), so commands that do slow work before their first reply fail
with "The application did not respond". These now call ctx.defer() (a
no-op for prefix commands): level (rank card render), snapshot and
snapshot load, voice play, info ip and info template. Their replies are
public, which matches what they send today.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rnxm
rnxm merged commit 8722059 into dev Nov 12, 2026
6 checks passed
@rnxm
rnxm deleted the fix/defer-heavy-commands branch November 12, 2026 11:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant