refactor(line): reuse reply chunk deps type

This commit is contained in:
Peter Steinberger
2026-02-16 02:29:07 +00:00
parent 35c5d2be5c
commit 39d5590230

View File

@@ -2,7 +2,7 @@ import type { messagingApi } from "@line/bot-sdk";
import type { ReplyPayload } from "../auto-reply/types.js"; import type { ReplyPayload } from "../auto-reply/types.js";
import type { FlexContainer } from "./flex-templates.js"; import type { FlexContainer } from "./flex-templates.js";
import type { ProcessedLineMessage } from "./markdown-to-line.js"; import type { ProcessedLineMessage } from "./markdown-to-line.js";
import type { LineReplyMessage, SendLineReplyChunksParams } from "./reply-chunks.js"; import type { SendLineReplyChunksParams } from "./reply-chunks.js";
import type { LineChannelData, LineTemplateMessagePayload } from "./types.js"; import type { LineChannelData, LineTemplateMessagePayload } from "./types.js";
export type LineAutoReplyDeps = { export type LineAutoReplyDeps = {
@@ -12,19 +12,6 @@ export type LineAutoReplyDeps = {
processLineMessage: (text: string) => ProcessedLineMessage; processLineMessage: (text: string) => ProcessedLineMessage;
chunkMarkdownText: (text: string, limit: number) => string[]; chunkMarkdownText: (text: string, limit: number) => string[];
sendLineReplyChunks: (params: SendLineReplyChunksParams) => Promise<{ replyTokenUsed: boolean }>; sendLineReplyChunks: (params: SendLineReplyChunksParams) => Promise<{ replyTokenUsed: boolean }>;
replyMessageLine: (
replyToken: string,
messages: messagingApi.Message[],
opts?: { accountId?: string },
) => Promise<unknown>;
pushMessageLine: (to: string, text: string, opts?: { accountId?: string }) => Promise<unknown>;
pushTextMessageWithQuickReplies: (
to: string,
text: string,
quickReplies: string[],
opts?: { accountId?: string },
) => Promise<unknown>;
createTextMessageWithQuickReplies: (text: string, quickReplies: string[]) => LineReplyMessage;
createQuickReplyItems: (labels: string[]) => messagingApi.QuickReply; createQuickReplyItems: (labels: string[]) => messagingApi.QuickReply;
pushMessagesLine: ( pushMessagesLine: (
to: string, to: string,
@@ -42,8 +29,14 @@ export type LineAutoReplyDeps = {
latitude: number; latitude: number;
longitude: number; longitude: number;
}) => messagingApi.LocationMessage; }) => messagingApi.LocationMessage;
onReplyError?: (err: unknown) => void; } & Pick<
}; SendLineReplyChunksParams,
| "replyMessageLine"
| "pushMessageLine"
| "pushTextMessageWithQuickReplies"
| "createTextMessageWithQuickReplies"
| "onReplyError"
>;
export async function deliverLineAutoReply(params: { export async function deliverLineAutoReply(params: {
payload: ReplyPayload; payload: ReplyPayload;