Merge 54a592711e into 6af205a13a
This commit is contained in:
commit
a86cdd4fa4
@ -258,7 +258,8 @@ export function resolveDiscordChannelConfigWithFallback(params: {
|
||||
scope,
|
||||
} = params;
|
||||
const channels = guildInfo?.channels;
|
||||
if (!channels) return null;
|
||||
// Return null if channels is undefined, null, or empty object - allows all channels when no allowlist is configured
|
||||
if (!channels || Object.keys(channels).length === 0) return null;
|
||||
const resolvedParentSlug = parentSlug ?? (parentName ? normalizeDiscordSlug(parentName) : "");
|
||||
const match = resolveDiscordChannelEntryMatch(
|
||||
channels,
|
||||
|
||||
@ -38,6 +38,7 @@ import {
|
||||
readChannelAllowFromStore,
|
||||
upsertChannelPairingRequest,
|
||||
} from "../../pairing/pairing-store.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
||||
import { loadWebMedia } from "../../web/media.js";
|
||||
import { chunkDiscordTextWithMode } from "../chunk.js";
|
||||
@ -656,6 +657,14 @@ async function dispatchDiscordCommandInteraction(params: {
|
||||
modeWhenAccessGroupsOff: "configured",
|
||||
});
|
||||
if (!commandAuthorized) {
|
||||
// Log warning when no allowlist is configured to help users debug
|
||||
const anyAuthorizerConfigured = authorizers.some((entry) => entry.configured);
|
||||
if (!anyAuthorizerConfigured) {
|
||||
logVerbose(
|
||||
`discord: slash command rejected for user ${user.id} - no allowlist configured. ` +
|
||||
`Configure channels.discord.guilds.<id>.users or channels.discord.dm.allowFrom to allow users.`,
|
||||
);
|
||||
}
|
||||
await respond("You are not authorized to use this command.", { ephemeral: true });
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user