mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 20:44:32 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -201,11 +201,17 @@ async function promptDiscordAllowFrom(params: {
|
||||
const parseInputs = (value: string) => parseDiscordAllowFromInput(value);
|
||||
const parseId = (value: string) => {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) return null;
|
||||
if (!trimmed) {
|
||||
return null;
|
||||
}
|
||||
const mention = trimmed.match(/^<@!?(\d+)>$/);
|
||||
if (mention) return mention[1];
|
||||
if (mention) {
|
||||
return mention[1];
|
||||
}
|
||||
const prefixed = trimmed.replace(/^(user:|discord:)/i, "");
|
||||
if (/^\d+$/.test(prefixed)) return prefixed;
|
||||
if (/^\d+$/.test(prefixed)) {
|
||||
return prefixed;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -387,7 +393,9 @@ export const discordOnboardingAdapter: ChannelOnboardingAdapter = {
|
||||
([guildKey, value]) => {
|
||||
const channels = value?.channels ?? {};
|
||||
const channelKeys = Object.keys(channels);
|
||||
if (channelKeys.length === 0) return [guildKey];
|
||||
if (channelKeys.length === 0) {
|
||||
return [guildKey];
|
||||
}
|
||||
return channelKeys.map((channelKey) => `${guildKey}/${channelKey}`);
|
||||
},
|
||||
);
|
||||
@@ -463,7 +471,9 @@ export const discordOnboardingAdapter: ChannelOnboardingAdapter = {
|
||||
const channelKey =
|
||||
entry.channelId ??
|
||||
(entry.channelName ? normalizeDiscordSlug(entry.channelName) : undefined);
|
||||
if (!channelKey && guildKey === "*") continue;
|
||||
if (!channelKey && guildKey === "*") {
|
||||
continue;
|
||||
}
|
||||
allowlistEntries.push({ guildKey, ...(channelKey ? { channelKey } : {}) });
|
||||
}
|
||||
next = setDiscordGroupPolicy(next, discordAccountId, "allowlist");
|
||||
|
||||
Reference in New Issue
Block a user