chore: Lint extensions folder.

This commit is contained in:
cpojer
2026-01-31 22:13:48 +09:00
parent 4f2166c503
commit 230ca789e2
221 changed files with 4006 additions and 1583 deletions

View File

@@ -99,7 +99,7 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
},
};
},
isEnabled: (account, cfg) => account.enabled !== false && cfg.web?.enabled !== false,
isEnabled: (account, cfg) => account.enabled && cfg.web?.enabled !== false,
disabledReason: () => "disabled",
isConfigured: async (account) =>
await getWhatsAppRuntime().channel.whatsapp.webAuthExists(account.authDir),
@@ -141,7 +141,9 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
collectWarnings: ({ account, cfg }) => {
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
const groupPolicy = account.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
if (groupPolicy !== "open") return [];
if (groupPolicy !== "open") {
return [];
}
const groupAllowlistConfigured =
Boolean(account.groups) && Object.keys(account.groups ?? {}).length > 0;
if (groupAllowlistConfigured) {
@@ -206,7 +208,9 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
mentions: {
stripPatterns: ({ ctx }) => {
const selfE164 = (ctx.To ?? "").replace(/^whatsapp:/, "");
if (!selfE164) return [];
if (!selfE164) {
return [];
}
const escaped = escapeRegExp(selfE164);
return [escaped, `@${escaped}`];
},
@@ -227,7 +231,9 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
const account = resolveWhatsAppAccount({ cfg, accountId });
const { e164, jid } = getWhatsAppRuntime().channel.whatsapp.readWebSelfId(account.authDir);
const id = e164 ?? jid;
if (!id) return null;
if (!id) {
return null;
}
return {
kind: "user",
id,
@@ -240,11 +246,17 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
},
actions: {
listActions: ({ cfg }) => {
if (!cfg.channels?.whatsapp) return [];
if (!cfg.channels?.whatsapp) {
return [];
}
const gate = createActionGate(cfg.channels.whatsapp.actions);
const actions = new Set<ChannelMessageActionName>();
if (gate("reactions")) actions.add("react");
if (gate("polls")) actions.add("poll");
if (gate("reactions")) {
actions.add("react");
}
if (gate("polls")) {
actions.add("poll");
}
return Array.from(actions);
},
supportsAction: ({ action }) => action === "react",