fix: clean up plugin linting and types
This commit is contained in:
parent
a87a07ec8a
commit
19775abdda
3 changed files with 6 additions and 4 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
"oxc/no-async-endpoint-handlers": "off",
|
"oxc/no-async-endpoint-handlers": "off",
|
||||||
"oxc/no-map-spread": "off",
|
"oxc/no-map-spread": "off",
|
||||||
"typescript/no-extraneous-class": "off",
|
"typescript/no-extraneous-class": "off",
|
||||||
|
"typescript/no-redundant-type-constituents": "off",
|
||||||
"typescript/no-unnecessary-template-expression": "off",
|
"typescript/no-unnecessary-template-expression": "off",
|
||||||
"typescript/no-unsafe-type-assertion": "off",
|
"typescript/no-unsafe-type-assertion": "off",
|
||||||
"unicorn/consistent-function-scoping": "off",
|
"unicorn/consistent-function-scoping": "off",
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ function resolveAccountConfig(
|
||||||
if (!accounts || typeof accounts !== "object") {
|
if (!accounts || typeof accounts !== "object") {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return accounts[accountId] as GoogleChatAccountConfig | undefined;
|
return accounts[accountId];
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeGoogleChatAccountConfig(
|
function mergeGoogleChatAccountConfig(
|
||||||
|
|
|
||||||
|
|
@ -347,9 +347,10 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
|
||||||
const createQuickReplyItems = runtime.channel.line.createQuickReplyItems;
|
const createQuickReplyItems = runtime.channel.line.createQuickReplyItems;
|
||||||
|
|
||||||
let lastResult: { messageId: string; chatId: string } | null = null;
|
let lastResult: { messageId: string; chatId: string } | null = null;
|
||||||
const hasQuickReplies = Boolean(lineData.quickReplies?.length);
|
const quickReplies = lineData.quickReplies ?? [];
|
||||||
|
const hasQuickReplies = quickReplies.length > 0;
|
||||||
const quickReply = hasQuickReplies
|
const quickReply = hasQuickReplies
|
||||||
? createQuickReplyItems(lineData.quickReplies!)
|
? createQuickReplyItems(quickReplies)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const sendMessageBatch = async (messages: Array<Record<string, unknown>>) => {
|
const sendMessageBatch = async (messages: Array<Record<string, unknown>>) => {
|
||||||
|
|
@ -433,7 +434,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
|
||||||
for (let i = 0; i < chunks.length; i += 1) {
|
for (let i = 0; i < chunks.length; i += 1) {
|
||||||
const isLast = i === chunks.length - 1;
|
const isLast = i === chunks.length - 1;
|
||||||
if (isLast && hasQuickReplies) {
|
if (isLast && hasQuickReplies) {
|
||||||
lastResult = await sendQuickReplies(to, chunks[i], lineData.quickReplies!, {
|
lastResult = await sendQuickReplies(to, chunks[i], quickReplies, {
|
||||||
verbose: false,
|
verbose: false,
|
||||||
accountId: accountId ?? undefined,
|
accountId: accountId ?? undefined,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue