mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:11:23 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -21,10 +21,18 @@ function bindingMatchKey(match: AgentBinding["match"]) {
|
||||
export function describeBinding(binding: AgentBinding) {
|
||||
const match = binding.match;
|
||||
const parts = [match.channel];
|
||||
if (match.accountId) parts.push(`accountId=${match.accountId}`);
|
||||
if (match.peer) parts.push(`peer=${match.peer.kind}:${match.peer.id}`);
|
||||
if (match.guildId) parts.push(`guild=${match.guildId}`);
|
||||
if (match.teamId) parts.push(`team=${match.teamId}`);
|
||||
if (match.accountId) {
|
||||
parts.push(`accountId=${match.accountId}`);
|
||||
}
|
||||
if (match.peer) {
|
||||
parts.push(`peer=${match.peer.kind}:${match.peer.id}`);
|
||||
}
|
||||
if (match.guildId) {
|
||||
parts.push(`guild=${match.guildId}`);
|
||||
}
|
||||
if (match.teamId) {
|
||||
parts.push(`team=${match.teamId}`);
|
||||
}
|
||||
return parts.join(" ");
|
||||
}
|
||||
|
||||
@@ -83,7 +91,9 @@ export function applyAgentBindings(
|
||||
|
||||
function resolveDefaultAccountId(cfg: OpenClawConfig, provider: ChannelId): string {
|
||||
const plugin = getChannelPlugin(provider);
|
||||
if (!plugin) return DEFAULT_ACCOUNT_ID;
|
||||
if (!plugin) {
|
||||
return DEFAULT_ACCOUNT_ID;
|
||||
}
|
||||
return resolveChannelDefaultAccountId({ plugin, cfg });
|
||||
}
|
||||
|
||||
@@ -122,7 +132,9 @@ export function parseBindingSpecs(params: {
|
||||
const agentId = normalizeAgentId(params.agentId);
|
||||
for (const raw of specs) {
|
||||
const trimmed = raw?.trim();
|
||||
if (!trimmed) continue;
|
||||
if (!trimmed) {
|
||||
continue;
|
||||
}
|
||||
const [channelRaw, accountRaw] = trimmed.split(":", 2);
|
||||
const channel = normalizeChannelId(channelRaw);
|
||||
if (!channel) {
|
||||
@@ -141,7 +153,9 @@ export function parseBindingSpecs(params: {
|
||||
}
|
||||
}
|
||||
const match: AgentBinding["match"] = { channel };
|
||||
if (accountId) match.accountId = accountId;
|
||||
if (accountId) {
|
||||
match.accountId = accountId;
|
||||
}
|
||||
bindings.push({ agentId, match });
|
||||
}
|
||||
return { bindings, errors };
|
||||
|
||||
Reference in New Issue
Block a user