Discord: a way to ignore messages outside `respondToChannelIds`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
Research direction
Start in packages/adapter-discord/src/index.ts, following the linked message handling and thread creation paths for direct and forwarded Gateway messages. Check how respondToChannelIds is used and where child threads and DMs are handled. Done means the proposed option prevents messages outside the configured channels from creating threads or reaching processMessage in both paths, while DMs and existing behavior remain intact.
Written by the indexing model from the issue text.
Description
Problem Statement
A Discord bot that should only work in one channel still answers mentions everywhere else in the server. respondToChannelIds (which I added in #715) only adds channels where every message counts as a mention. A mention in any other channel still counts as a mention, and the adapter creates a Discord thread on that message before any handler runs. Filtering in onNewMention is too late, because the thread is already there.
With respondToChannelIds: ["allowed"] on 4.45.0, a forwarded Gateway mention in other fires onNewMention and calls POST /channels/other/messages/<id>/threads, the same as a mention in allowed.
Proposed Solution
A separate option, so respondToChannelIds keeps its meaning for current users. For example ignoreOtherChannels: true: the adapter drops guild messages whose parent channel isn't in respondToChannelIds, and their child threads, before it creates a thread or calls processMessage. It applies to both the direct and the forwarded Gateway paths. DMs keep working.
Alternatives Considered
A shouldHandleMessage(message) hook that runs before thread creation. It's more flexible, but a channel allowlist covers the case I have.
Use Case
import { createDiscordAdapter } from "@chat-adapter/discord";
const discord = createDiscordAdapter({
respondToChannelIds: [process.env.SUPPORT_CHANNEL_ID!],
ignoreOtherChannels: true,
});
Priority
Nice to have
Contribution
- I am willing to help implement this feature
Additional Context
Chat SDK 4.45.0, Node.js 24.21.0. We run this as a patch on the adapter today.
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 355
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 42
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/chat
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
X and Twitch: paragraphs inside a block quote are joined with no spacePossibly taken @abhiramshaji-cyber claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
🛠️ dette technique
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
betagouv/mon-entreprise#4752 · 1 comment ·
Maintainers usually reply within 5 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
franciscoBSalgueiro/en-croissant#1111 ·
Maintainers usually reply within 2 days
-
area/providers type/feature version/v2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anomalyco/opencode#64845 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day