Skip to content

Commit

Permalink
fix: 更新依赖,添加错误日志
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-cn committed Sep 27, 2024
1 parent 0b26c46 commit 1a5cd0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/adapters/qq/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Adapter } from "@/adapter";
import { App } from "@/server/app";
import { OneBot, OneBotStatus } from "@/onebot";
import { Bot, Sendable, Quotable, MessageElem } from "qq-official-bot";
import { Bot, Sendable, Quotable } from "qq-official-bot";
import * as path from "path";

export default class QQAdapter extends Adapter<"qq", Sendable> {
Expand Down
13 changes: 8 additions & 5 deletions src/service/V12/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ export class V12 extends Service<"V12"> implements OneBot.Base {
const ret = await this.apply(ctx.query as unknown as V12.RequestAction);
ctx.res.writeHead(200).end(ret);
} catch (e) {
ctx.res.writeHead(500).end(e.message);
this.logger.error(e);
ctx.res.writeHead(500).end(e.stack || e.message);
}
} else if (ctx.method === "POST") {
try {
Expand All @@ -583,7 +584,8 @@ export class V12 extends Service<"V12"> implements OneBot.Base {
const ret = await this.apply(params as unknown as V12.RequestAction);
ctx.res.writeHead(200).end(ret);
} catch (e) {
ctx.res.writeHead(500).end(e.message);
this.logger.error(e);
ctx.res.writeHead(500).end(e.stack || e.message);
}
} else {
ctx.res.writeHead(405).end();
Expand All @@ -598,7 +600,8 @@ export class V12 extends Service<"V12"> implements OneBot.Base {
const ret = await this.apply({ action, params: ctx.query });
ctx.res.writeHead(200).end(ret);
} catch (e) {
ctx.res.writeHead(500).end(e.message);
this.logger.error(e);
ctx.res.writeHead(500).end(e.stack || e.message);
}
} else if (ctx.method === "POST") {
try {
Expand All @@ -609,7 +612,8 @@ export class V12 extends Service<"V12"> implements OneBot.Base {
const ret = await this.apply({ action, params });
ctx.res.writeHead(200).end(ret);
} catch (e) {
ctx.res.writeHead(500).end(e.message);
this.logger.error(e);
ctx.res.writeHead(500).end(e.stack || e.message);
}
} else {
ctx.res.writeHead(405).end();
Expand Down Expand Up @@ -666,7 +670,6 @@ export class V12 extends Service<"V12"> implements OneBot.Base {
const headers: http.OutgoingHttpHeaders = {
"User-Agent": `OneBot/12 (${this.oneBot.platform}) onebots/${version}`,
};
console.log(config);
if (config.access_token) headers.Authorization = "Bearer " + config.access_token;
const ws = new WebSocket(remoteUrl, ["12.OneBots"], { headers });
ws.on("error", err => {
Expand Down

0 comments on commit 1a5cd0c

Please sign in to comment.