onebots 0.4.65 → 0.4.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/adapter.js CHANGED
@@ -23,6 +23,15 @@ class Adapter extends events_1.EventEmitter {
23
23
  this.config = config;
24
24
  this.oneBots = new Map();
25
25
  _Adapter_logger.set(this, void 0);
26
+ this.on("message.receive", (uin, ...args) => {
27
+ this.oneBots.get(uin)?.emit("message.receive", ...args);
28
+ });
29
+ this.on("notice.receive", (uin, ...args) => {
30
+ this.oneBots.get(uin)?.emit("notice.receive", ...args);
31
+ });
32
+ this.on("request.receive", (uin, ...args) => {
33
+ this.oneBots.get(uin)?.emit("request.receive", ...args);
34
+ });
26
35
  }
27
36
  materialize(content) {
28
37
  return content
@@ -141,16 +141,16 @@ class V11 extends service_1.Service {
141
141
  });
142
142
  }, this.config.heartbeat * 1000);
143
143
  }
144
- this.adapter.on("message.receive", (uin, event) => {
145
- const payload = this.adapter.formatEventPayload(uin, "V11", "message", event);
144
+ this.oneBot.on("message.receive", event => {
145
+ const payload = this.adapter.formatEventPayload(this.oneBot.uin, "V11", "message", event);
146
146
  this.dispatch(payload);
147
147
  });
148
- this.adapter.on("notice.receive", (uin, event) => {
149
- const payload = this.adapter.formatEventPayload(uin, "V11", "notice", event);
148
+ this.oneBot.on("notice.receive", event => {
149
+ const payload = this.adapter.formatEventPayload(this.oneBot.uin, "V11", "notice", event);
150
150
  this.dispatch(payload);
151
151
  });
152
- this.adapter.on("request.receive", (uin, event) => {
153
- const payload = this.adapter.formatEventPayload(uin, "V11", "request", event);
152
+ this.oneBot.on("request.receive", event => {
153
+ const payload = this.adapter.formatEventPayload(this.oneBot.uin, "V11", "request", event);
154
154
  this.dispatch(payload);
155
155
  });
156
156
  }
@@ -6,11 +6,11 @@ export declare class CommonAction {
6
6
  * 撤回消息
7
7
  * @param message_id {string} 消息id
8
8
  */
9
- deleteMsg(this: V12, message_id: string): Promise<any>;
9
+ deleteMessage(this: V12, message_id: string): Promise<any>;
10
10
  /**
11
11
  * 获取消息详情
12
12
  */
13
- getMsg(this: V12, message_id: string): Promise<any>;
13
+ getMessage(this: V12, message_id: string): Promise<any>;
14
14
  getSelfInfo(this: V12): {
15
15
  user_id: string;
16
16
  platform: string;
@@ -12,13 +12,13 @@ class CommonAction {
12
12
  * 撤回消息
13
13
  * @param message_id {string} 消息id
14
14
  */
15
- deleteMsg(message_id) {
15
+ deleteMessage(message_id) {
16
16
  return this.adapter.call(this.oneBot.uin, "V12", "deleteMsg", [message_id]);
17
17
  }
18
18
  /**
19
19
  * 获取消息详情
20
20
  */
21
- async getMsg(message_id) {
21
+ async getMessage(message_id) {
22
22
  const message = await this.adapter.call(this.oneBot.uin, "V12", "getMessage", [message_id]);
23
23
  if (!message)
24
24
  throw new Error("消息不存在");
@@ -136,16 +136,16 @@ class V12 extends service_1.Service {
136
136
  }));
137
137
  }, this.config.heartbeat * 1000);
138
138
  }
139
- this.adapter.on("message.receive", (uin, event) => {
140
- const payload = this.adapter.formatEventPayload(uin, "V12", "message", event);
139
+ this.oneBot.on("message.receive", event => {
140
+ const payload = this.adapter.formatEventPayload(this.oneBot.uin, "V12", "message", event);
141
141
  this.dispatch(payload);
142
142
  });
143
- this.adapter.on("notice.receive", (uin, event) => {
144
- const payload = this.adapter.formatEventPayload(uin, "V12", "notice", event);
143
+ this.oneBot.on("notice.receive", event => {
144
+ const payload = this.adapter.formatEventPayload(this.oneBot.uin, "V12", "notice", event);
145
145
  this.dispatch(payload);
146
146
  });
147
- this.adapter.on("request.receive", (uin, event) => {
148
- const payload = this.adapter.formatEventPayload(uin, "V12", "request", event);
147
+ this.oneBot.on("request.receive", event => {
148
+ const payload = this.adapter.formatEventPayload(this.oneBot.uin, "V12", "request", event);
149
149
  this.dispatch(payload);
150
150
  });
151
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onebots",
3
- "version": "0.4.65",
3
+ "version": "0.4.67",
4
4
  "description": "基于icqq的多例oneBot实现",
5
5
  "main": "lib/index.js",
6
6
  "bin": {