fix: resolve lint errors (unused vars, imports, formatting)
- Prefix unused test variables with underscore - Remove unused piSpec import and idleMs class member - Fix import ordering and code formatting
This commit is contained in:
committed by
Peter Steinberger
parent
518af0ef24
commit
4a35bcec21
@@ -84,13 +84,15 @@ function buildMentionConfig(cfg: ReturnType<typeof loadConfig>): MentionConfig {
|
||||
const gc = cfg.inbound?.groupChat;
|
||||
const requireMention = gc?.requireMention !== false; // default true
|
||||
const mentionRegexes =
|
||||
gc?.mentionPatterns?.map((p) => {
|
||||
try {
|
||||
return new RegExp(p, "i");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}).filter((r): r is RegExp => Boolean(r)) ?? [];
|
||||
gc?.mentionPatterns
|
||||
?.map((p) => {
|
||||
try {
|
||||
return new RegExp(p, "i");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter((r): r is RegExp => Boolean(r)) ?? [];
|
||||
return { requireMention, mentionRegexes };
|
||||
}
|
||||
|
||||
@@ -728,7 +730,7 @@ export async function monitorWebProvider(
|
||||
const senderLabel =
|
||||
latest.senderName && latest.senderE164
|
||||
? `${latest.senderName} (${latest.senderE164})`
|
||||
: latest.senderName ?? latest.senderE164 ?? "Unknown";
|
||||
: (latest.senderName ?? latest.senderE164 ?? "Unknown");
|
||||
combinedBody = `${combinedBody}\\n[from: ${senderLabel}]`;
|
||||
// Clear stored history after using it
|
||||
groupHistories.set(conversationId, []);
|
||||
@@ -834,7 +836,7 @@ export async function monitorWebProvider(
|
||||
const fromDisplay =
|
||||
latest.chatType === "group"
|
||||
? conversationId
|
||||
: latest.from ?? "unknown";
|
||||
: (latest.from ?? "unknown");
|
||||
if (isVerbose()) {
|
||||
console.log(
|
||||
success(
|
||||
@@ -850,24 +852,26 @@ export async function monitorWebProvider(
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(
|
||||
danger(`Failed sending web auto-reply to ${latest.from ?? conversationId}: ${String(err)}`),
|
||||
danger(
|
||||
`Failed sending web auto-reply to ${latest.from ?? conversationId}: ${String(err)}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const enqueueBatch = async (msg: WebInboundMsg) => {
|
||||
const key = msg.conversationId ?? msg.from;
|
||||
const bucket = pendingBatches.get(key) ?? { messages: [] };
|
||||
bucket.messages.push(msg);
|
||||
pendingBatches.set(key, bucket);
|
||||
if (getQueueSize() === 0) {
|
||||
await processBatch(key);
|
||||
} else {
|
||||
bucket.timer =
|
||||
bucket.timer ?? setTimeout(() => void processBatch(key), 150);
|
||||
}
|
||||
};
|
||||
const enqueueBatch = async (msg: WebInboundMsg) => {
|
||||
const key = msg.conversationId ?? msg.from;
|
||||
const bucket = pendingBatches.get(key) ?? { messages: [] };
|
||||
bucket.messages.push(msg);
|
||||
pendingBatches.set(key, bucket);
|
||||
if (getQueueSize() === 0) {
|
||||
await processBatch(key);
|
||||
} else {
|
||||
bucket.timer =
|
||||
bucket.timer ?? setTimeout(() => void processBatch(key), 150);
|
||||
}
|
||||
};
|
||||
|
||||
const listener = await (listenerFactory ?? monitorWebInbox)({
|
||||
verbose,
|
||||
|
||||
@@ -339,7 +339,9 @@ export async function monitorWebInbox(options: {
|
||||
} as const;
|
||||
}
|
||||
|
||||
function unwrapMessage(message: proto.IMessage | undefined): proto.IMessage | undefined {
|
||||
function unwrapMessage(
|
||||
message: proto.IMessage | undefined,
|
||||
): proto.IMessage | undefined {
|
||||
if (!message) return undefined;
|
||||
if (message.ephemeralMessage?.message) {
|
||||
return unwrapMessage(message.ephemeralMessage.message as proto.IMessage);
|
||||
|
||||
Reference in New Issue
Block a user