mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:08:26 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -33,13 +33,9 @@ export async function maybeBroadcastMessage(params: {
|
||||
if (broadcastAgents.length === 0) return false;
|
||||
|
||||
const strategy = params.cfg.broadcast?.strategy || "parallel";
|
||||
whatsappInboundLog.info(
|
||||
`Broadcasting message to ${broadcastAgents.length} agents (${strategy})`,
|
||||
);
|
||||
whatsappInboundLog.info(`Broadcasting message to ${broadcastAgents.length} agents (${strategy})`);
|
||||
|
||||
const agentIds = params.cfg.agents?.list?.map((agent) =>
|
||||
normalizeAgentId(agent.id),
|
||||
);
|
||||
const agentIds = params.cfg.agents?.list?.map((agent) => normalizeAgentId(agent.id));
|
||||
const hasKnownAgents = (agentIds?.length ?? 0) > 0;
|
||||
const groupHistorySnapshot =
|
||||
params.msg.chatType === "group"
|
||||
@@ -49,9 +45,7 @@ export async function maybeBroadcastMessage(params: {
|
||||
const processForAgent = async (agentId: string): Promise<boolean> => {
|
||||
const normalizedAgentId = normalizeAgentId(agentId);
|
||||
if (hasKnownAgents && !agentIds?.includes(normalizedAgentId)) {
|
||||
whatsappInboundLog.warn(
|
||||
`Broadcast agent ${agentId} not found in agents.list; skipping`,
|
||||
);
|
||||
whatsappInboundLog.warn(`Broadcast agent ${agentId} not found in agents.list; skipping`);
|
||||
return false;
|
||||
}
|
||||
const agentRoute = {
|
||||
@@ -72,19 +66,12 @@ export async function maybeBroadcastMessage(params: {
|
||||
};
|
||||
|
||||
try {
|
||||
return await params.processMessage(
|
||||
params.msg,
|
||||
agentRoute,
|
||||
params.groupHistoryKey,
|
||||
{
|
||||
groupHistory: groupHistorySnapshot,
|
||||
suppressGroupHistoryClear: true,
|
||||
},
|
||||
);
|
||||
return await params.processMessage(params.msg, agentRoute, params.groupHistoryKey, {
|
||||
groupHistory: groupHistorySnapshot,
|
||||
suppressGroupHistoryClear: true,
|
||||
});
|
||||
} catch (err) {
|
||||
whatsappInboundLog.error(
|
||||
`Broadcast agent ${agentId} failed: ${formatError(err)}`,
|
||||
);
|
||||
whatsappInboundLog.error(`Broadcast agent ${agentId} failed: ${formatError(err)}`);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -95,12 +82,8 @@ export async function maybeBroadcastMessage(params: {
|
||||
if (await processForAgent(agentId)) didSendReply = true;
|
||||
}
|
||||
} else {
|
||||
const results = await Promise.allSettled(
|
||||
broadcastAgents.map(processForAgent),
|
||||
);
|
||||
didSendReply = results.some(
|
||||
(result) => result.status === "fulfilled" && result.value,
|
||||
);
|
||||
const results = await Promise.allSettled(broadcastAgents.map(processForAgent));
|
||||
didSendReply = results.some((result) => result.status === "fulfilled" && result.value);
|
||||
}
|
||||
|
||||
if (params.msg.chatType === "group" && didSendReply) {
|
||||
|
||||
Reference in New Issue
Block a user