mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
refactor: simplify discord preflight conversions
This commit is contained in:
@@ -606,7 +606,7 @@ export async function preflightDiscordMessage(
|
||||
// Use the active runtime snapshot for bindings lookup; routing inputs are
|
||||
// still payload-derived, but this path should not reparse config from disk.
|
||||
const memberRoleIds = Array.isArray(params.data.rawMember?.roles)
|
||||
? params.data.rawMember.roles.map((roleId: string) => String(roleId))
|
||||
? params.data.rawMember.roles
|
||||
: [];
|
||||
const freshCfg = loadConfig();
|
||||
const conversationRuntime = await loadConversationRuntime();
|
||||
@@ -697,10 +697,9 @@ export async function preflightDiscordMessage(
|
||||
(message.mentionedRoles?.length ?? 0) > 0 ||
|
||||
(message.mentionedEveryone && (!author.bot || sender.isPluralKit))),
|
||||
);
|
||||
const hasUserOrRoleMention = Boolean(
|
||||
const hasUserOrRoleMention =
|
||||
!isDirectMessage &&
|
||||
((message.mentionedUsers?.length ?? 0) > 0 || (message.mentionedRoles?.length ?? 0) > 0),
|
||||
);
|
||||
((message.mentionedUsers?.length ?? 0) > 0 || (message.mentionedRoles?.length ?? 0) > 0);
|
||||
|
||||
if (
|
||||
isGuildMessage &&
|
||||
@@ -963,7 +962,7 @@ export async function preflightDiscordMessage(
|
||||
},
|
||||
policy: {
|
||||
isGroup: isGuildMessage,
|
||||
requireMention: Boolean(shouldRequireMention),
|
||||
requireMention: shouldRequireMention,
|
||||
allowTextCommands,
|
||||
hasControlCommand: hasControlCommandInMessage,
|
||||
commandAuthorized,
|
||||
|
||||
Reference in New Issue
Block a user