fix: gate group activation by owner
This commit is contained in:
@@ -89,7 +89,11 @@ export function buildCommandContext(params: {
|
|||||||
const ownerList = ownerCandidates
|
const ownerList = ownerCandidates
|
||||||
.map((entry) => normalizeE164(entry))
|
.map((entry) => normalizeE164(entry))
|
||||||
.filter((entry): entry is string => Boolean(entry));
|
.filter((entry): entry is string => Boolean(entry));
|
||||||
const isAuthorizedSender = commandAuthorized;
|
const isOwner =
|
||||||
|
!isWhatsAppSurface ||
|
||||||
|
ownerList.length === 0 ||
|
||||||
|
(senderE164 ? ownerList.includes(senderE164) : false);
|
||||||
|
const isAuthorizedSender = commandAuthorized && isOwner;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
surface,
|
surface,
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ import { hasControlCommand } from "../auto-reply/command-detection.js";
|
|||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||||
import type { ReplyToMode } from "../config/config.js";
|
import type {
|
||||||
|
DiscordSlashCommandConfig,
|
||||||
|
ReplyToMode,
|
||||||
|
} from "../config/config.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
resolveSessionKey,
|
resolveSessionKey,
|
||||||
@@ -43,6 +46,7 @@ export type MonitorDiscordOpts = {
|
|||||||
mediaMaxMb?: number;
|
mediaMaxMb?: number;
|
||||||
historyLimit?: number;
|
historyLimit?: number;
|
||||||
replyToMode?: ReplyToMode;
|
replyToMode?: ReplyToMode;
|
||||||
|
slashCommand?: DiscordSlashCommandConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DiscordMediaInfo = {
|
type DiscordMediaInfo = {
|
||||||
|
|||||||
Reference in New Issue
Block a user