diff --git a/adapters/lark/src/http.ts b/adapters/lark/src/http.ts index 727cc4f7..a2e5918a 100644 --- a/adapters/lark/src/http.ts +++ b/adapters/lark/src/http.ts @@ -3,29 +3,29 @@ import { ReadableStream } from 'node:stream/web' import { Adapter, Context, Logger, Schema } from '@satorijs/core' import {} from '@cordisjs/plugin-server' -import { FeishuBot } from './bot' +import { LarkBot } from './bot' import { EventPayload } from './types' import { adaptSession, Cipher } from './utils' -export class HttpServer extends Adapter> { +export class HttpServer extends Adapter> { static inject = ['server'] private logger: Logger private ciphers: Record = {} - constructor(ctx: C, bot: FeishuBot) { + constructor(ctx: C, bot: LarkBot) { super(ctx) this.logger = ctx.logger('lark') } - fork(ctx: C, bot: FeishuBot) { + fork(ctx: C, bot: LarkBot) { super.fork(ctx, bot) this._refreshCipher() return bot.initialize() } - async connect(bot: FeishuBot) { + async connect(bot: LarkBot) { const { path } = bot.config bot.ctx.server.post(path, (ctx) => { this._refreshCipher() diff --git a/adapters/lark/src/utils.ts b/adapters/lark/src/utils.ts index 03dead25..b7f89e41 100644 --- a/adapters/lark/src/utils.ts +++ b/adapters/lark/src/utils.ts @@ -1,6 +1,6 @@ import crypto from 'crypto' import { Context, h, Session, trimSlash, Universal } from '@satorijs/core' -import { FeishuBot, LarkBot } from './bot' +import { LarkBot } from './bot' import { EventPayload, Events, GetImChatResponse, Lark, MessageContentType, MessageType } from './types' export type Sender = @@ -22,7 +22,7 @@ export function adaptSender(sender: Sender, session: Session): Session { return session } -export async function adaptMessage(bot: FeishuBot, data: Events['im.message.receive_v1'], session: Session, details = true): Promise { +export async function adaptMessage(bot: LarkBot, data: Events['im.message.receive_v1'], session: Session, details = true): Promise { const json = JSON.parse(data.message.content) as MessageContentType const assetEndpoint = trimSlash(bot.config.selfUrl ?? bot.ctx.server.config.selfUrl) + bot.config.path + '/assets' const content: (string | h)[] = [] @@ -71,7 +71,7 @@ export async function adaptMessage(bot: FeishuBot, data: Events['im.message.rece return session } -export async function adaptSession(bot: FeishuBot, body: EventPayload) { +export async function adaptSession(bot: LarkBot, body: EventPayload) { const session = bot.session() session.setInternal('lark', body)