onebots 0.1.7 → 0.1.9

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.
@@ -15,25 +15,25 @@ async function processMusic(target_type, target_id, element) {
15
15
  }
16
16
  exports.processMusic = processMusic;
17
17
  async function processMessage(message, quote_id) {
18
- const forward = message.find(e => e.type === 'node');
19
- if (forward)
20
- (0, utils_1.remove)(message, forward);
18
+ const forwardNodes = message.filter(e => e.type === 'node');
19
+ if (forwardNodes.length)
20
+ message = message.filter((segment) => !forwardNodes.includes(segment));
21
21
  let quote = message.find(e => e.type === 'reply');
22
22
  if (quote)
23
23
  (0, utils_1.remove)(message, quote);
24
24
  const element = V12_1.V12.fromSegment(message);
25
- if (forward)
25
+ if (forwardNodes)
26
26
  element.unshift(
27
27
  // 构造抓发消息
28
28
  await this.makeForwardMsg(await Promise.all(
29
29
  // 处理转发消息段
30
- forward.data.message.map(async (segment) => {
30
+ forwardNodes.map(async (forwardNode) => {
31
31
  return {
32
32
  // 转发套转发处理
33
- message: (await processMessage.apply(this, [V12_1.V12.fromSegment([segment])])).element,
34
- user_id: forward.data.user_id,
35
- nickname: forward.data.user_name,
36
- time: forward.data.time
33
+ message: (await processMessage.apply(this, [V12_1.V12.fromSegment(forwardNode.data.message)])).element,
34
+ user_id: Number(forwardNode.data.user_id),
35
+ nickname: forwardNode.data.user_name,
36
+ time: forwardNode.data.time
37
37
  };
38
38
  }))));
39
39
  if (quote && !quote_id)
@@ -60,7 +60,7 @@ export declare namespace V12 {
60
60
  interface SegmentMap {
61
61
  face: {
62
62
  id: number;
63
- text: string;
63
+ text?: string;
64
64
  };
65
65
  text: {
66
66
  text: string;
@@ -91,11 +91,11 @@ export declare namespace V12 {
91
91
  location: {
92
92
  latitude: number;
93
93
  longitude: number;
94
- title: string;
95
- content: string;
94
+ title?: string;
95
+ content?: string;
96
96
  };
97
97
  node: {
98
- user_id: number;
98
+ user_id: string;
99
99
  time?: number;
100
100
  user_name?: string;
101
101
  message: SegmentElem[];
@@ -556,8 +556,15 @@ class V12 extends events_1.EventEmitter {
556
556
  }));
557
557
  }
558
558
  });
559
- this.dispatch(V12.formatPayload(this.oneBot.uin, "connect", this.action.getVersion.apply(this)));
560
- this.dispatch(V12.formatPayload(this.oneBot.uin, "status_update", this.action.getStatus.apply(this)));
559
+ this.dispatch(V12.formatPayload(this.oneBot.uin, "connect", {
560
+ detail_type: "connect",
561
+ type: 'meta',
562
+ version: this.action.getVersion.apply(this)
563
+ }));
564
+ this.dispatch(V12.formatPayload(this.oneBot.uin, "status_update", {
565
+ detail_type: 'status_update',
566
+ status: this.action.getStatus.apply(this)
567
+ }));
561
568
  }
562
569
  }
563
570
  exports.V12 = V12;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onebots",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "基于icqq的多例oneBot实现",
5
5
  "engines": {
6
6
  "node": ">=16"