feat(discord): add wildcard channel config support

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.
This commit is contained in:
Wimmie
2026-01-20 20:49:40 +00:00
committed by Peter Steinberger
parent 9b47f463b7
commit 64d29b0c31
2 changed files with 43 additions and 1 deletions

View File

@@ -234,7 +234,14 @@ export function resolveDiscordChannelConfig(params: {
name: channelName,
slug: channelSlug,
});
if (!match.entry || !match.matchKey) return { allowed: false };
if (!match.entry || !match.matchKey) {
// Wildcard fallback: apply to all channels if "*" is configured
const wildcard = channels["*"];
if (wildcard) {
return resolveDiscordChannelConfigEntry(wildcard, "*", "direct");
}
return { allowed: false };
}
return resolveDiscordChannelConfigEntry(match.entry, match.matchKey, "direct");
}
@@ -284,6 +291,11 @@ export function resolveDiscordChannelConfigWithFallback(params: {
match.matchSource === "parent" ? "parent" : "direct",
);
}
// Wildcard fallback: apply to all channels if "*" is configured
const wildcard = channels["*"];
if (wildcard) {
return resolveDiscordChannelConfigEntry(wildcard, "*", "direct");
}
return { allowed: false };
}