Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pvoo
Copy link
Contributor

@pvoo pvoo commented Jan 20, 2026

Summary

Add support for * wildcard in Discord channel configuration, matching the existing guild-level wildcard behavior.

Motivation

Currently, to apply settings like autoThread to all channels in a guild, you need to list each channel explicitly. This PR adds wildcard support so you can configure defaults for all channels:

guilds:
  '*':
    channels:
      '*': { autoThread: true }

Specific channel configs still take precedence over the wildcard.

Changes

  • src/discord/monitor/allow-list.ts: Added wildcard fallback in resolveDiscordChannelConfig
  • src/discord/monitor.test.ts: Added test for wildcard channel config

Testing

  • All existing tests pass
  • New test added for wildcard channel behavior
  • Verified build succeeds

Add support for '*' wildcard in Discord channel configuration,
matching the existing guild-level wildcard behavior.

This allows applying default channel settings (like autoThread)
to all channels without listing each one explicitly:

  guilds:
    '*':
      channels:
        '*': { autoThread: true }

Specific channel configs still take precedence over the wildcard.
@pvoo pvoo force-pushed the feature/discord-channel-wildcard branch from 16bcb71 to 7e71801 Compare January 20, 2026 20:59
@pvoo
Copy link
Contributor Author

pvoo commented Jan 20, 2026

CI Note

The failing checks (format, protocol, swiftlint) are pre-existing failures on main - see main CI run #21185760477.

My changes (wildcard channel config) pass lint and tests locally:

  • pnpm lint
  • pnpm test -- monitor.test ✅ (36 tests pass including new wildcard test)
  • pnpm build

The format/protocol/swift failures need to be fixed on main separately.

@steipete
Copy link
Contributor

Thank you! Good find. Fix is suboptimal, will rewrite.

  • Shared wildcard logic already exists: resolveChannelEntryMatchWithFallback supports wildcardKey + matchSource: "wildcard"; tests prove precedence direct > parent > wildcard. src/channels/channel-config.ts
  • Slack already uses it with wildcardKey: "*" and consumes wildcard fallback. src/slack/monitor/channel-config.ts
  • Discord currently calls the helper without wildcardKey, then PR adds an ad‑hoc fallback + coerces matchSource to "direct", so logs/ meta are wrong. src/discord/monitor/allow-list.ts
  • Other providers already support * in allowlists (not channel‑config maps): Telegram normalizeAllowFrom/resolveSenderAllowMatch, Signal parseSignalAllowEntry, WhatsApp/web inbound access control. src/ telegram/bot-access.ts, src/signal/identity.ts, src/web/inbound/ access-control.ts

Proposed fix (shared, consistent):

  • Discord: pass wildcardKey: "*" via resolveDiscordChannelEntryMatch (no ad‑hoc fallback).
  • Extend DiscordChannelConfigResolved.matchSource + resolveDiscordChannelConfigEntry to include "wildcard" and pass through match.matchSource (don’t coerce).
  • Add test covering wildcard via resolveDiscordChannelConfigWithFallback (thread/parent path) and assert matchSource: "wildcard"

@steipete
Copy link
Contributor

Landed on main with:

  • 64d29b0 feat(discord): add wildcard channel config support
  • f0a8b34 fix(discord): align wildcard channel matching (shared matcher + wildcard matchSource)
  • b52ab96 docs(changelog): note discord wildcard fix

Notes: switched Discord wildcard handling to the shared channel match helper (matchSource now reports wildcard) and added a thread-path wildcard test. Changelog updated with thanks.

@steipete
Copy link
Contributor

Merged on main via 64d29b0 + f0a8b34 + b52ab96 (PR branch showed merge conflicts).

@steipete steipete closed this Jan 21, 2026
@pvoo
Copy link
Contributor Author

pvoo commented Jan 21, 2026

@steipete thanks you're right, should have checked other providers and shared wildcard logic.

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