Skip to content

fix(discord): route unauthorized DMs to pairing - #4899

Merged
Re-bin merged 1 commit into
mainfrom
fix/discord-dm-pairing-4897
Jul 13, 2026
Merged

Re-bin merged 1 commit into
mainfrom
fix/discord-dm-pairing-4897

Conversation

@chengyongru

Copy link
Copy Markdown
Collaborator

Summary

  • allow unauthorized Discord DMs to reach the shared BaseChannel pairing flow
  • keep unauthorized guild messages rejected before attachment, reaction, or typing side effects
  • cover first-contact DM pairing through the Discord adapter

Root cause

DiscordChannel._should_accept_inbound rejected every sender who was not already allowlisted or paired. That prevented the initial DM from reaching BaseChannel._handle_message, where pairing codes are generated.

Tests

  • python -m pytest tests/channels/test_base_channel.py tests/channels/test_discord_channel.py -q (63 passed)
  • python -m ruff check nanobot/channels/discord.py tests/channels/test_discord_channel.py

Fixes #4897

@chengyongru chengyongru added priority: p1 Important user-impacting issue or project priority with bounded impact or a reasonable workaround. fix bug Something isn't working channel labels Jul 13, 2026
@chengyongru

Copy link
Copy Markdown
Collaborator Author
image

@Re-bin Re-bin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. This restores first-contact Discord DM pairing while keeping unauthorized guild messages rejected before channel-side effects. The adapter-local regression test covers the broken path, and the channel tests and CI are green.

@Re-bin
Re-bin merged commit 6d406d9 into main Jul 13, 2026
5 checks passed
@Re-bin
Re-bin deleted the fix/discord-dm-pairing-4897 branch July 13, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channel fix priority: p1 Important user-impacting issue or project priority with bounded impact or a reasonable workaround. valid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with Discord bot integration

2 participants