onebots 0.0.28 → 0.0.30
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/bin.js +0 -1
- package/lib/onebot.d.ts +2 -2
- package/lib/onebot.js +15 -15
- package/lib/service/V11/action/common.d.ts +2 -2
- package/lib/service/V11/action/friend.d.ts +4 -4
- package/lib/service/V11/action/friend.js +2 -2
- package/lib/service/V11/action/group.d.ts +6 -6
- package/lib/service/V11/action/group.js +2 -2
- package/lib/service/V11/index.d.ts +1 -1
- package/lib/service/V11/index.js +7 -7
- package/lib/service/V12/action/common.d.ts +1 -1
- package/lib/service/V12/action/common.js +2 -2
- package/lib/service/V12/action/friend.d.ts +3 -3
- package/lib/service/V12/action/group.d.ts +5 -5
- package/lib/service/V12/index.d.ts +2 -2
- package/lib/service/V12/index.js +7 -6
- package/package.json +3 -3
package/lib/bin.js
CHANGED
package/lib/onebot.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import '
|
|
2
|
+
import 'icqq-cq-enable';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
import { App } from "./server/app";
|
|
5
|
-
import { Client } from "
|
|
5
|
+
import { Client } from "icqq";
|
|
6
6
|
import { V11 } from "./service/V11";
|
|
7
7
|
import { V12 } from "./service/V12";
|
|
8
8
|
import { MayBeArray } from "./types";
|
package/lib/onebot.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BOOLS = exports.OneBotStatus = exports.OneBot = exports.NotFoundError = void 0;
|
|
4
|
-
require("
|
|
4
|
+
require("icqq-cq-enable");
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const app_1 = require("./server/app");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const
|
|
10
|
-
const message_1 = require("
|
|
9
|
+
const icqq_1 = require("icqq");
|
|
10
|
+
const message_1 = require("icqq/lib/message");
|
|
11
11
|
const V11_1 = require("./service/V11");
|
|
12
12
|
const V12_1 = require("./service/V12");
|
|
13
13
|
class NotFoundError extends Error {
|
|
@@ -38,7 +38,7 @@ class OneBot extends events_1.EventEmitter {
|
|
|
38
38
|
throw new Error('不支持的oneBot版本:' + c.version);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
this.client = new
|
|
41
|
+
this.client = new icqq_1.Client({ platform: this.app.config.platform, data_dir: (0, path_1.join)(app_1.App.configDir, 'data') });
|
|
42
42
|
this.instances = this.config.map(c => {
|
|
43
43
|
switch (c.version) {
|
|
44
44
|
case 'V11':
|
|
@@ -58,7 +58,7 @@ class OneBot extends events_1.EventEmitter {
|
|
|
58
58
|
disposeArr.shift()();
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
this.client.
|
|
61
|
+
this.client.trap('system.login.qrcode', function qrcodeHelper() {
|
|
62
62
|
console.log('扫码后回车继续');
|
|
63
63
|
process.stdin.once('data', () => {
|
|
64
64
|
this.login();
|
|
@@ -67,7 +67,7 @@ class OneBot extends events_1.EventEmitter {
|
|
|
67
67
|
this.off('system.login.qrcode', qrcodeHelper);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
-
this.client.
|
|
70
|
+
this.client.trap('system.login.device', function deviceHelper() {
|
|
71
71
|
console.log('请输入密保手机接收的验证码');
|
|
72
72
|
this.sendSmsCode();
|
|
73
73
|
process.stdin.once('data', (e) => {
|
|
@@ -77,7 +77,7 @@ class OneBot extends events_1.EventEmitter {
|
|
|
77
77
|
this.off('system.login.device', deviceHelper);
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
|
-
this.client.
|
|
80
|
+
this.client.trap('system.login.error', function errorHandler(e) {
|
|
81
81
|
if (e.message.includes('密码错误')) {
|
|
82
82
|
process.stdin.once('data', (e) => {
|
|
83
83
|
this.login(e.toString().trim());
|
|
@@ -88,7 +88,7 @@ class OneBot extends events_1.EventEmitter {
|
|
|
88
88
|
}
|
|
89
89
|
this.off('system.login.error', errorHandler);
|
|
90
90
|
});
|
|
91
|
-
this.client.
|
|
91
|
+
this.client.trap('system.login.slider', function sliderHelper(e) {
|
|
92
92
|
console.log('滑块验证地址:' + e.url);
|
|
93
93
|
console.log('请输入滑块验证返回的ticket');
|
|
94
94
|
process.stdin.once('data', (e) => {
|
|
@@ -98,14 +98,14 @@ class OneBot extends events_1.EventEmitter {
|
|
|
98
98
|
this.off('system.login.slider', sliderHelper);
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
|
-
this.client.
|
|
102
|
-
await this.client.login(this.password);
|
|
101
|
+
this.client.trap('system.online', clean);
|
|
102
|
+
await this.client.login(this.uin, this.password);
|
|
103
103
|
}
|
|
104
104
|
startListen() {
|
|
105
|
-
this.client.
|
|
106
|
-
this.client.
|
|
107
|
-
this.client.
|
|
108
|
-
this.client.
|
|
105
|
+
this.client.trap('system', this.dispatch.bind(this, 'system'));
|
|
106
|
+
this.client.trap('notice', this.dispatch.bind(this, 'notice'));
|
|
107
|
+
this.client.trap('request', this.dispatch.bind(this, 'request'));
|
|
108
|
+
this.client.trap('message', this.dispatch.bind(this, 'message'));
|
|
109
109
|
for (const instance of this.instances) {
|
|
110
110
|
instance.start(this.instances.length > 1 ? '/' + instance.version : undefined);
|
|
111
111
|
}
|
|
@@ -114,7 +114,7 @@ class OneBot extends events_1.EventEmitter {
|
|
|
114
114
|
for (const instance of this.instances) {
|
|
115
115
|
await instance.stop(force);
|
|
116
116
|
}
|
|
117
|
-
this.client.
|
|
117
|
+
this.client.logout(force);
|
|
118
118
|
}
|
|
119
119
|
dispatch(event, data) {
|
|
120
120
|
for (const instance of this.instances) {
|
|
@@ -16,12 +16,12 @@ export declare class CommonAction {
|
|
|
16
16
|
* 获取消息
|
|
17
17
|
* @param message_id {string} 消息id
|
|
18
18
|
*/
|
|
19
|
-
getMsg(this: V11, message_id: string): Promise<import("
|
|
19
|
+
getMsg(this: V11, message_id: string): Promise<import("icqq").GroupMessage | import("icqq").PrivateMessage>;
|
|
20
20
|
/**
|
|
21
21
|
* 获取合并消息
|
|
22
22
|
* @param id {string} 合并id
|
|
23
23
|
*/
|
|
24
|
-
getForwardMsg(this: V11, id: string): Promise<import("
|
|
24
|
+
getForwardMsg(this: V11, id: string): Promise<import("icqq").ForwardMessage[]>;
|
|
25
25
|
/**
|
|
26
26
|
* 获取 Cookies
|
|
27
27
|
* @param domain {string} 域名
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OneBot } from "../../../onebot";
|
|
2
2
|
import { V11 } from "../../../service/V11";
|
|
3
|
-
import { SegmentElem } from "
|
|
3
|
+
import { SegmentElem } from "icqq-cq-enable/lib/utils";
|
|
4
4
|
export declare class FriendAction {
|
|
5
5
|
/**
|
|
6
6
|
* 发送私聊消息
|
|
@@ -8,11 +8,11 @@ export declare class FriendAction {
|
|
|
8
8
|
* @param message {import('oicq').Sendable} 发送的消息
|
|
9
9
|
* @param message_id {string} 引用的消息ID
|
|
10
10
|
*/
|
|
11
|
-
sendPrivateMsg(this: V11, user_id: number, message: string | SegmentElem[], message_id?: string): Promise<import("
|
|
11
|
+
sendPrivateMsg(this: V11, user_id: number, message: string | SegmentElem[], message_id?: string): Promise<import("icqq").MessageRet>;
|
|
12
12
|
/**
|
|
13
13
|
* 获取好友列表
|
|
14
14
|
*/
|
|
15
|
-
getFriendList(this: OneBot<'V11'>): Promise<import("
|
|
15
|
+
getFriendList(this: OneBot<'V11'>): Promise<import("icqq").FriendInfo[]>;
|
|
16
16
|
/**
|
|
17
17
|
* 处理好友添加请求
|
|
18
18
|
* @param flag {string} 请求flag
|
|
@@ -27,7 +27,7 @@ export declare class FriendAction {
|
|
|
27
27
|
getStrangerInfo(this: OneBot<'V11'>, user_id: number): Promise<{
|
|
28
28
|
user_id: number;
|
|
29
29
|
nickname: string;
|
|
30
|
-
sex: import("
|
|
30
|
+
sex: import("icqq").Gender;
|
|
31
31
|
age: number;
|
|
32
32
|
area: string;
|
|
33
33
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FriendAction = void 0;
|
|
4
|
-
const
|
|
4
|
+
const icqq_cq_enable_1 = require("icqq-cq-enable");
|
|
5
5
|
class FriendAction {
|
|
6
6
|
/**
|
|
7
7
|
* 发送私聊消息
|
|
@@ -10,7 +10,7 @@ class FriendAction {
|
|
|
10
10
|
* @param message_id {string} 引用的消息ID
|
|
11
11
|
*/
|
|
12
12
|
async sendPrivateMsg(user_id, message, message_id) {
|
|
13
|
-
const element = typeof message === 'string' ? (0,
|
|
13
|
+
const element = typeof message === 'string' ? (0, icqq_cq_enable_1.fromCqcode)(message) : (0, icqq_cq_enable_1.fromSegment)(message);
|
|
14
14
|
let quote, quoteIdx = element.findIndex(e => e.type === 'reply');
|
|
15
15
|
if (quoteIdx !== -1) {
|
|
16
16
|
quote = element[quoteIdx];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V11 } from "../../../service/V11";
|
|
2
|
-
import { SegmentElem } from "
|
|
2
|
+
import { SegmentElem } from "icqq-cq-enable/lib/utils";
|
|
3
3
|
export declare class GroupAction {
|
|
4
4
|
/**
|
|
5
5
|
* 发送群聊消息
|
|
@@ -7,7 +7,7 @@ export declare class GroupAction {
|
|
|
7
7
|
* @param message {import('oicq').Sendable} 消息
|
|
8
8
|
* @param message_id {string} 引用的消息ID
|
|
9
9
|
*/
|
|
10
|
-
sendGroupMsg(this: V11, group_id: number, message: string | SegmentElem[], message_id?: string): Promise<import("
|
|
10
|
+
sendGroupMsg(this: V11, group_id: number, message: string | SegmentElem[], message_id?: string): Promise<import("icqq").MessageRet>;
|
|
11
11
|
/**
|
|
12
12
|
* 群组踢人
|
|
13
13
|
* @param group_id {number} 群id
|
|
@@ -85,21 +85,21 @@ export declare class GroupAction {
|
|
|
85
85
|
/**
|
|
86
86
|
* 获取群列表
|
|
87
87
|
*/
|
|
88
|
-
getGroupList(this: V11): Promise<Map<number, import("
|
|
88
|
+
getGroupList(this: V11): Promise<Map<number, import("icqq").GroupInfo>>;
|
|
89
89
|
/**
|
|
90
90
|
* 获取指定群信息
|
|
91
91
|
* @param group_id
|
|
92
92
|
*/
|
|
93
|
-
getGroupInfo(this: V11, group_id: number): Promise<import("
|
|
93
|
+
getGroupInfo(this: V11, group_id: number): Promise<import("icqq").GroupInfo>;
|
|
94
94
|
/**
|
|
95
95
|
* 获取群成员列表
|
|
96
96
|
* @param group_id
|
|
97
97
|
*/
|
|
98
|
-
getGroupMemberList(this: V11, group_id: number): Promise<Map<number, import("
|
|
98
|
+
getGroupMemberList(this: V11, group_id: number): Promise<Map<number, import("icqq").MemberInfo>>;
|
|
99
99
|
/**
|
|
100
100
|
* 获取指定群成员信息
|
|
101
101
|
* @param group_id
|
|
102
102
|
* @param user_id
|
|
103
103
|
*/
|
|
104
|
-
getGroupMemberInfo(this: V11, group_id: number, user_id: number): Promise<import("
|
|
104
|
+
getGroupMemberInfo(this: V11, group_id: number, user_id: number): Promise<import("icqq").MemberInfo>;
|
|
105
105
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GroupAction = void 0;
|
|
4
|
-
const
|
|
4
|
+
const icqq_cq_enable_1 = require("icqq-cq-enable");
|
|
5
5
|
class GroupAction {
|
|
6
6
|
/**
|
|
7
7
|
* 发送群聊消息
|
|
@@ -10,7 +10,7 @@ class GroupAction {
|
|
|
10
10
|
* @param message_id {string} 引用的消息ID
|
|
11
11
|
*/
|
|
12
12
|
async sendGroupMsg(group_id, message, message_id) {
|
|
13
|
-
const element = typeof message === 'string' ? (0,
|
|
13
|
+
const element = typeof message === 'string' ? (0, icqq_cq_enable_1.fromCqcode)(message) : (0, icqq_cq_enable_1.fromSegment)(message);
|
|
14
14
|
let quote, quoteIdx = element.findIndex(e => e.type === 'reply');
|
|
15
15
|
if (quoteIdx !== -1) {
|
|
16
16
|
quote = element[quoteIdx];
|
package/lib/service/V11/index.js
CHANGED
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.V11 = void 0;
|
|
7
|
-
const
|
|
7
|
+
const icqq_1 = require("icqq");
|
|
8
8
|
const action_1 = require("./action");
|
|
9
9
|
const onebot_1 = require("../../onebot");
|
|
10
10
|
const ws_1 = require("ws");
|
|
11
11
|
const url_1 = require("url");
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
|
-
const
|
|
13
|
+
const icqq_cq_enable_1 = require("icqq-cq-enable");
|
|
14
14
|
const onebot_2 = require("../../onebot");
|
|
15
15
|
const http_1 = __importDefault(require("http"));
|
|
16
16
|
const https_1 = __importDefault(require("https"));
|
|
@@ -63,7 +63,7 @@ class V11 extends events_1.EventEmitter {
|
|
|
63
63
|
this.dispatch({
|
|
64
64
|
self_id: this.client.uin,
|
|
65
65
|
status: {
|
|
66
|
-
online: this.client.status ===
|
|
66
|
+
online: this.client.status === icqq_1.OnlineStatus.Online,
|
|
67
67
|
good: this.oneBot.status === onebot_1.OneBotStatus.Good
|
|
68
68
|
},
|
|
69
69
|
time: Math.floor(Date.now() / 1000),
|
|
@@ -174,7 +174,7 @@ class V11 extends events_1.EventEmitter {
|
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
async stop(force) {
|
|
177
|
-
if (this.client.status ===
|
|
177
|
+
if (this.client.status === icqq_1.OnlineStatus.Online) {
|
|
178
178
|
await this.client.terminate();
|
|
179
179
|
}
|
|
180
180
|
if (force) {
|
|
@@ -190,7 +190,7 @@ class V11 extends events_1.EventEmitter {
|
|
|
190
190
|
if (data.post_type === 'system') {
|
|
191
191
|
}
|
|
192
192
|
if (data.message && data.post_type === 'message') {
|
|
193
|
-
data.message = this.config.post_message_format === 'array' ? (0,
|
|
193
|
+
data.message = this.config.post_message_format === 'array' ? (0, icqq_cq_enable_1.toSegment)(data.message) : (0, icqq_cq_enable_1.toCqcode)(data);
|
|
194
194
|
}
|
|
195
195
|
data.time = Math.floor(Date.now() / 1000);
|
|
196
196
|
this.emit('dispatch', JSON.stringify(data));
|
|
@@ -393,10 +393,10 @@ class V11 extends events_1.EventEmitter {
|
|
|
393
393
|
params[k] = (0, utils_1.toBool)(params[k]);
|
|
394
394
|
if (k === 'message') {
|
|
395
395
|
if (typeof params[k] === 'string') {
|
|
396
|
-
params[k] = (0,
|
|
396
|
+
params[k] = (0, icqq_cq_enable_1.fromCqcode)(params[k]);
|
|
397
397
|
}
|
|
398
398
|
else {
|
|
399
|
-
params[k] = (0,
|
|
399
|
+
params[k] = (0, icqq_cq_enable_1.fromSegment)(params[k]);
|
|
400
400
|
}
|
|
401
401
|
params['message_id'] = params[k].find(e => e.type === 'reply')?.message_id;
|
|
402
402
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommonAction = void 0;
|
|
4
|
-
const
|
|
4
|
+
const icqq_1 = require("icqq");
|
|
5
5
|
const onebot_1 = require("../../../onebot");
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
class CommonAction {
|
|
@@ -27,7 +27,7 @@ class CommonAction {
|
|
|
27
27
|
bots: [
|
|
28
28
|
{
|
|
29
29
|
self: this.action.getSelfInfo.apply(this),
|
|
30
|
-
online: this.client.status =
|
|
30
|
+
online: this.client.status = icqq_1.OnlineStatus.Online,
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
};
|
|
@@ -3,16 +3,16 @@ export declare class FriendAction {
|
|
|
3
3
|
getUserInfo(this: V12, user_id: number): Promise<{
|
|
4
4
|
user_id: number;
|
|
5
5
|
nickname: string;
|
|
6
|
-
sex: import("
|
|
6
|
+
sex: import("icqq").Gender;
|
|
7
7
|
age: number;
|
|
8
8
|
area: string;
|
|
9
9
|
}>;
|
|
10
|
-
getFriendList(this: V12): Map<number, import("
|
|
10
|
+
getFriendList(this: V12): Map<number, import("icqq").FriendInfo>;
|
|
11
11
|
/**
|
|
12
12
|
* 发送私聊消息
|
|
13
13
|
* @param user_id {number} 用户id
|
|
14
14
|
* @param message {import('oicq').Sendable} 发送的消息
|
|
15
15
|
* @param message_id {string} 引用的消息ID
|
|
16
16
|
*/
|
|
17
|
-
sendPrivateMsg(this: V12, user_id: number, message: V12.SegmentElem[], message_id?: string): Promise<import("
|
|
17
|
+
sendPrivateMsg(this: V12, user_id: number, message: V12.SegmentElem[], message_id?: string): Promise<import("icqq").MessageRet>;
|
|
18
18
|
}
|
|
@@ -6,7 +6,7 @@ export declare class GroupAction {
|
|
|
6
6
|
* @param message {import('oicq').Sendable} 消息
|
|
7
7
|
* @param message_id {string} 引用的消息ID
|
|
8
8
|
*/
|
|
9
|
-
sendGroupMsg(this: V12, group_id: number, message: V12.SegmentElem[], message_id?: string): Promise<import("
|
|
9
|
+
sendGroupMsg(this: V12, group_id: number, message: V12.SegmentElem[], message_id?: string): Promise<import("icqq").MessageRet>;
|
|
10
10
|
/**
|
|
11
11
|
* 群组踢人
|
|
12
12
|
* @param group_id {number} 群id
|
|
@@ -84,21 +84,21 @@ export declare class GroupAction {
|
|
|
84
84
|
/**
|
|
85
85
|
* 获取群列表
|
|
86
86
|
*/
|
|
87
|
-
getGroupList(this: V12): Promise<Map<number, import("
|
|
87
|
+
getGroupList(this: V12): Promise<Map<number, import("icqq").GroupInfo>>;
|
|
88
88
|
/**
|
|
89
89
|
* 获取指定群信息
|
|
90
90
|
* @param group_id
|
|
91
91
|
*/
|
|
92
|
-
getGroupInfo(this: V12, group_id: number): Promise<import("
|
|
92
|
+
getGroupInfo(this: V12, group_id: number): Promise<import("icqq").GroupInfo>;
|
|
93
93
|
/**
|
|
94
94
|
* 获取群成员列表
|
|
95
95
|
* @param group_id
|
|
96
96
|
*/
|
|
97
|
-
getGroupMemberList(this: V12, group_id: number): Promise<Map<number, import("
|
|
97
|
+
getGroupMemberList(this: V12, group_id: number): Promise<Map<number, import("icqq").MemberInfo>>;
|
|
98
98
|
/**
|
|
99
99
|
* 获取指定群成员信息
|
|
100
100
|
* @param group_id
|
|
101
101
|
* @param user_id
|
|
102
102
|
*/
|
|
103
|
-
getGroupMemberInfo(this: V12, group_id: number, user_id: number): Promise<import("
|
|
103
|
+
getGroupMemberInfo(this: V12, group_id: number, user_id: number): Promise<import("icqq").MemberInfo>;
|
|
104
104
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { Client, EventMap, MessageElem, Sendable } from "
|
|
3
|
+
import { Client, EventMap, MessageElem, Sendable } from "icqq";
|
|
4
4
|
import { Config } from './config';
|
|
5
5
|
import { OneBot } from "../../onebot";
|
|
6
6
|
import { Action } from "./action";
|
|
@@ -137,7 +137,7 @@ export declare namespace V12 {
|
|
|
137
137
|
const defaultConfig: Config;
|
|
138
138
|
type Payload<T extends any> = {
|
|
139
139
|
id: string;
|
|
140
|
-
impl: '
|
|
140
|
+
impl: 'icqq_onebot';
|
|
141
141
|
version: 12;
|
|
142
142
|
platform: 'qq';
|
|
143
143
|
self: {
|
package/lib/service/V12/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.V12 = void 0;
|
|
7
|
-
const
|
|
7
|
+
const icqq_1 = require("icqq");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const onebot_1 = require("../../onebot");
|
|
10
10
|
const action_1 = require("./action");
|
|
@@ -118,7 +118,7 @@ class V12 extends events_1.EventEmitter {
|
|
|
118
118
|
"Content-Type": "application/json",
|
|
119
119
|
"User-Agent": "OneBot/12 (qq) Node-onebots/0.0.15",
|
|
120
120
|
"X-OneBot-Version": 12,
|
|
121
|
-
"X-Impl": "
|
|
121
|
+
"X-Impl": "icqq_onebot",
|
|
122
122
|
},
|
|
123
123
|
};
|
|
124
124
|
if (config.access_token) {
|
|
@@ -261,7 +261,7 @@ class V12 extends events_1.EventEmitter {
|
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
async stop(force) {
|
|
264
|
-
if (this.client.status ===
|
|
264
|
+
if (this.client.status === icqq_1.OnlineStatus.Online) {
|
|
265
265
|
await this.client.terminate();
|
|
266
266
|
}
|
|
267
267
|
this.wss.close();
|
|
@@ -318,7 +318,7 @@ class V12 extends events_1.EventEmitter {
|
|
|
318
318
|
dispatch(data) {
|
|
319
319
|
const payload = {
|
|
320
320
|
id: (0, utils_1.uuid)(),
|
|
321
|
-
impl: '
|
|
321
|
+
impl: 'icqq_onebot',
|
|
322
322
|
version: 12,
|
|
323
323
|
platform: 'qq',
|
|
324
324
|
self: {
|
|
@@ -340,7 +340,7 @@ class V12 extends events_1.EventEmitter {
|
|
|
340
340
|
action = "send_" + params.detail_type + "_msg";
|
|
341
341
|
}
|
|
342
342
|
else if (params.user_id)
|
|
343
|
-
action = "
|
|
343
|
+
action = "send_Private_Msg";
|
|
344
344
|
else if (params.group_id)
|
|
345
345
|
action = "send_group_msg";
|
|
346
346
|
else if (params.discuss_id)
|
|
@@ -569,9 +569,10 @@ exports.V12 = V12;
|
|
|
569
569
|
return { type: 'text', text: msg };
|
|
570
570
|
}
|
|
571
571
|
const { type, data, ...other } = msg;
|
|
572
|
+
if (type === 'mention')
|
|
573
|
+
data['qq'] = Number(data['user_id']);
|
|
572
574
|
return {
|
|
573
575
|
type: type.replace('mention', 'at').replace('at_all', 'at'),
|
|
574
|
-
qq: data['user_id'],
|
|
575
576
|
...other,
|
|
576
577
|
...data
|
|
577
578
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onebots",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "基于oicq的多例oneBot实现",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@koa/router": "^10.1.1",
|
|
53
|
+
"icqq": "^0.0.13-4",
|
|
54
|
+
"icqq-cq-enable": "^1.0.0",
|
|
53
55
|
"js-yaml": "^4.1.0",
|
|
54
56
|
"koa": "^2.13.4",
|
|
55
57
|
"koa-bodyparser": "^4.3.0",
|
|
56
58
|
"log4js": "^6.5.2",
|
|
57
|
-
"oicq": "^2.3.1",
|
|
58
|
-
"oicq2-cq-enable": "^1.0.6",
|
|
59
59
|
"ws": "^8.8.0"
|
|
60
60
|
}
|
|
61
61
|
}
|