Skip to content

Commit

Permalink
Merge pull request #167 from BennettChina/master
Browse files Browse the repository at this point in the history
fix: 修复V11获取版本信息API和转发异常
  • Loading branch information
lc-cn authored Oct 10, 2024
2 parents 2117bab + 4006445 commit b951f1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/adapters/icqq/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Adapter } from "@/adapter";
import { App } from "@/server/app";
import { Client, Config as IcqqConfig, MessageElem, Quotable, Sendable } from "@icqqjs/icqq";
import { Client, Config as IcqqConfig, Quotable, Sendable } from "@icqqjs/icqq";
import process from "process";
import { rmSync } from "fs";
import { OneBot, OneBotStatus } from "@/onebot";
Expand Down Expand Up @@ -294,13 +294,14 @@ export default class IcqqAdapter extends Adapter<"icqq", Sendable> {
.map(item => {
if (typeof item === "string") return item;
const { type, data } = item;
if (type === "node")
if (type === "node") {
return {
type,
user_id: data.user_id,
nickname: data.nickname,
message: this.fromSegment(onebot, version, data.message),
user_id: data.user_id || data.uin,
nickname: data.nickname || data.name,
message: this.fromSegment(onebot, version, data.content)
};
}
return { type, ...data };
});
}
Expand Down
7 changes: 4 additions & 3 deletions src/service/V11/action/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { OneBotStatus } from "@/onebot";
import { V11 } from "@/service/V11";
import { version } from "@/utils";

export class CommonAction {
/**
Expand Down Expand Up @@ -77,10 +78,10 @@ export class CommonAction {
/**
* 获取版本信息
*/
getVersion(this: V11) {
getVersionInfo(this: V11) {
return {
app_name: "icqq",
app_version: "2.x",
app_name: "onebots",
app_version: version,
protocol_version: "v11",
};
}
Expand Down
1 change: 1 addition & 0 deletions src/service/V11/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ export class V11 extends Service<"V11"> implements OneBot.Base {
} else {
code = 1400;
message = "请求格式错误";
this.logger.error("_webSocketHandler fail: ", e);
}
ws.send(
JSON.stringify({
Expand Down

0 comments on commit b951f1f

Please sign in to comment.