@alemonjs/qq-bot 0.0.15 → 0.0.17
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/dist/assets/index.css +1 -472
- package/dist/assets/index.js +12 -11015
- package/dist/index.html +1 -1
- package/lib/desktop.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.group.js +3 -3
- package/lib/index.guild.js +3 -3
- package/lib/sdk/api.js +16 -13
- package/lib/sdk/intents.js +14 -2
- package/lib/sdk/websoket.group.js +1 -1
- package/package.json +1 -1
package/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>AlemonJS</title>
|
|
8
8
|
<script type="module" crossorigin src="/assets/index.js"></script>
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index.css"
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index.css">
|
|
10
10
|
</head>
|
|
11
11
|
|
|
12
12
|
<body>
|
package/lib/desktop.js
CHANGED
|
@@ -36,7 +36,7 @@ const activate = context => {
|
|
|
36
36
|
value['qq-bot'] = {
|
|
37
37
|
...qqBot,
|
|
38
38
|
// master_key 12121,1313,1313,13 转为数组
|
|
39
|
-
master_key: qqBot.master_key.split(',')
|
|
39
|
+
master_key: qqBot.master_key.split(',')
|
|
40
40
|
};
|
|
41
41
|
config.saveValue(value);
|
|
42
42
|
context.notification('QQ Bot 配置保存成功~');
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ import { QQBotAPI } from './sdk/api.js';
|
|
|
4
4
|
type Client = typeof QQBotAPI.prototype;
|
|
5
5
|
declare const client: Client;
|
|
6
6
|
declare const platform = "qq-bot";
|
|
7
|
-
declare const _default: alemonjs.
|
|
7
|
+
declare const _default: alemonjs.DefinePlatformValue;
|
|
8
8
|
|
|
9
9
|
export { type Client, client, _default as default, platform };
|
package/lib/index.group.js
CHANGED
|
@@ -13,10 +13,10 @@ var QQBotGroup = defineBot(() => {
|
|
|
13
13
|
const client = new QQBotGroupClient({
|
|
14
14
|
app_id: config?.app_id,
|
|
15
15
|
intents: config?.intents ?? ['GROUP_AND_C2C_EVENT'],
|
|
16
|
-
is_private: config?.is_private,
|
|
17
|
-
sandbox: config?.sandbox,
|
|
16
|
+
is_private: config?.is_private ?? false,
|
|
17
|
+
sandbox: config?.sandbox ?? false,
|
|
18
18
|
secret: config?.secret,
|
|
19
|
-
shard: config?.shard,
|
|
19
|
+
shard: config?.shard ?? [0, 1],
|
|
20
20
|
token: config?.token,
|
|
21
21
|
mode: config?.mode
|
|
22
22
|
});
|
package/lib/index.guild.js
CHANGED
|
@@ -19,10 +19,10 @@ var QQBotGuild = defineBot(() => {
|
|
|
19
19
|
'PUBLIC_GUILD_MESSAGES', //公域事件
|
|
20
20
|
'REACTIONS' // 表情表态
|
|
21
21
|
],
|
|
22
|
-
is_private: config?.is_private,
|
|
23
|
-
sandbox: config?.sandbox,
|
|
22
|
+
is_private: config?.is_private ?? false,
|
|
23
|
+
sandbox: config?.sandbox ?? false,
|
|
24
24
|
secret: config?.secret,
|
|
25
|
-
shard: config?.shard,
|
|
25
|
+
shard: config?.shard ?? [0, 1],
|
|
26
26
|
token: config?.token,
|
|
27
27
|
mode: config?.mode
|
|
28
28
|
});
|
package/lib/sdk/api.js
CHANGED
|
@@ -71,20 +71,23 @@ class QQBotAPI {
|
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
73
|
async gateway() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
const mode = config.get('mode');
|
|
75
|
+
if (mode === 'group') {
|
|
76
|
+
return this.groupService({
|
|
77
|
+
url: '/gateway'
|
|
78
|
+
}).then(res => res?.data);
|
|
79
|
+
}
|
|
80
|
+
else if (mode === 'guild') {
|
|
81
|
+
return this.guildServer({
|
|
82
|
+
url: '/gateway'
|
|
83
|
+
}).then(res => res?.data);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// 默认group
|
|
87
|
+
return this.groupService({
|
|
88
|
+
url: '/gateway'
|
|
89
|
+
}).then(res => res?.data);
|
|
84
90
|
}
|
|
85
|
-
return this[service]({
|
|
86
|
-
url: '/gateway'
|
|
87
|
-
}).then(res => res?.data);
|
|
88
91
|
}
|
|
89
92
|
/**
|
|
90
93
|
* 发送私聊消息
|
package/lib/sdk/intents.js
CHANGED
|
@@ -76,12 +76,24 @@ const intentsMap = {
|
|
|
76
76
|
GUILD_MESSAGES: 1 << 9,
|
|
77
77
|
GUILD_MESSAGE_REACTIONS: 1 << 10,
|
|
78
78
|
DIRECT_MESSAGE: 1 << 12,
|
|
79
|
-
GROUP_AND_C2C_EVENT: 1 << 25,
|
|
80
79
|
INTERACTION: 1 << 26,
|
|
81
80
|
MESSAGE_AUDIT: 1 << 27,
|
|
82
81
|
FORUMS_EVENT: 1 << 28,
|
|
83
82
|
AUDIO_ACTION: 1 << 29,
|
|
84
|
-
PUBLIC_GUILD_MESSAGES: 1 << 30
|
|
83
|
+
PUBLIC_GUILD_MESSAGES: 1 << 30,
|
|
84
|
+
INTERACTION_CREATE: 1 << 26,
|
|
85
|
+
// group
|
|
86
|
+
GROUP_AND_C2C_EVENT: 1 << 25,
|
|
87
|
+
C2C_MESSAGE_CREATE: 1 << 25,
|
|
88
|
+
FRIEND_ADD: 1 << 25,
|
|
89
|
+
FRIEND_DEL: 1 << 25,
|
|
90
|
+
C2C_MSG_REJECT: 1 << 25,
|
|
91
|
+
C2C_MSG_RECEIVE: 1 << 25,
|
|
92
|
+
GROUP_AT_MESSAGE_CREATE: 1 << 25,
|
|
93
|
+
GROUP_ADD_ROBOT: 1 << 25,
|
|
94
|
+
GROUP_DEL_ROBOT: 1 << 25,
|
|
95
|
+
GROUP_MSG_REJECT: 1 << 25,
|
|
96
|
+
GROUP_MSG_RECEIVE: 1 << 25,
|
|
85
97
|
};
|
|
86
98
|
/**
|
|
87
99
|
*
|