mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 03:28:29 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -23,7 +23,9 @@ type TelegramGroupMembershipAuditSummary = {
|
||||
};
|
||||
|
||||
function readTelegramAccountStatus(value: ChannelAccountSnapshot): TelegramAccountStatus | null {
|
||||
if (!isRecord(value)) return null;
|
||||
if (!isRecord(value)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
accountId: value.accountId,
|
||||
enabled: value.enabled,
|
||||
@@ -36,7 +38,9 @@ function readTelegramAccountStatus(value: ChannelAccountSnapshot): TelegramAccou
|
||||
function readTelegramGroupMembershipAuditSummary(
|
||||
value: unknown,
|
||||
): TelegramGroupMembershipAuditSummary {
|
||||
if (!isRecord(value)) return {};
|
||||
if (!isRecord(value)) {
|
||||
return {};
|
||||
}
|
||||
const unresolvedGroups =
|
||||
typeof value.unresolvedGroups === "number" && Number.isFinite(value.unresolvedGroups)
|
||||
? value.unresolvedGroups
|
||||
@@ -49,9 +53,13 @@ function readTelegramGroupMembershipAuditSummary(
|
||||
const groups = Array.isArray(groupsRaw)
|
||||
? (groupsRaw
|
||||
.map((entry) => {
|
||||
if (!isRecord(entry)) return null;
|
||||
if (!isRecord(entry)) {
|
||||
return null;
|
||||
}
|
||||
const chatId = asString(entry.chatId);
|
||||
if (!chatId) return null;
|
||||
if (!chatId) {
|
||||
return null;
|
||||
}
|
||||
const ok = typeof entry.ok === "boolean" ? entry.ok : undefined;
|
||||
const status = asString(entry.status) ?? null;
|
||||
const error = asString(entry.error) ?? null;
|
||||
@@ -70,11 +78,15 @@ export function collectTelegramStatusIssues(
|
||||
const issues: ChannelStatusIssue[] = [];
|
||||
for (const entry of accounts) {
|
||||
const account = readTelegramAccountStatus(entry);
|
||||
if (!account) continue;
|
||||
if (!account) {
|
||||
continue;
|
||||
}
|
||||
const accountId = asString(account.accountId) ?? "default";
|
||||
const enabled = account.enabled !== false;
|
||||
const configured = account.configured === true;
|
||||
if (!enabled || !configured) continue;
|
||||
if (!enabled || !configured) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (account.allowUnmentionedGroups === true) {
|
||||
issues.push({
|
||||
@@ -108,7 +120,9 @@ export function collectTelegramStatusIssues(
|
||||
});
|
||||
}
|
||||
for (const group of audit.groups ?? []) {
|
||||
if (group.ok === true) continue;
|
||||
if (group.ok === true) {
|
||||
continue;
|
||||
}
|
||||
const status = group.status ? ` status=${group.status}` : "";
|
||||
const err = group.error ? `: ${group.error}` : "";
|
||||
const baseMessage = `Group ${group.chatId} not reachable by bot.${status}${err}`;
|
||||
|
||||
Reference in New Issue
Block a user