Merge 54a592711e into 6af205a13a
This commit is contained in:
commit
a86cdd4fa4
@ -258,7 +258,8 @@ export function resolveDiscordChannelConfigWithFallback(params: {
|
|||||||
scope,
|
scope,
|
||||||
} = params;
|
} = params;
|
||||||
const channels = guildInfo?.channels;
|
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 resolvedParentSlug = parentSlug ?? (parentName ? normalizeDiscordSlug(parentName) : "");
|
||||||
const match = resolveDiscordChannelEntryMatch(
|
const match = resolveDiscordChannelEntryMatch(
|
||||||
channels,
|
channels,
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import {
|
|||||||
readChannelAllowFromStore,
|
readChannelAllowFromStore,
|
||||||
upsertChannelPairingRequest,
|
upsertChannelPairingRequest,
|
||||||
} from "../../pairing/pairing-store.js";
|
} from "../../pairing/pairing-store.js";
|
||||||
|
import { logVerbose } from "../../globals.js";
|
||||||
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
import { resolveAgentRoute } from "../../routing/resolve-route.js";
|
||||||
import { loadWebMedia } from "../../web/media.js";
|
import { loadWebMedia } from "../../web/media.js";
|
||||||
import { chunkDiscordTextWithMode } from "../chunk.js";
|
import { chunkDiscordTextWithMode } from "../chunk.js";
|
||||||
@ -656,6 +657,14 @@ async function dispatchDiscordCommandInteraction(params: {
|
|||||||
modeWhenAccessGroupsOff: "configured",
|
modeWhenAccessGroupsOff: "configured",
|
||||||
});
|
});
|
||||||
if (!commandAuthorized) {
|
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 });
|
await respond("You are not authorized to use this command.", { ephemeral: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user