@alemonjs/qq-bot 2.1.25 → 2.1.27
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/index.html +1 -1
- package/lib/message/group/GROUP_MEMBER_ADD.d.ts +6 -0
- package/lib/message/group/GROUP_MEMBER_ADD.js +1 -0
- package/lib/message/group/GROUP_MEMBER_REMOVE.d.ts +6 -0
- package/lib/message/group/GROUP_MEMBER_REMOVE.js +1 -0
- package/lib/register.js +21 -1
- package/lib/sdk/message.group.d.ts +4 -0
- package/package.json +4 -4
package/dist/index.html
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/lib/register.js
CHANGED
|
@@ -88,6 +88,26 @@ const register = (client) => {
|
|
|
88
88
|
.addOpen({ OpenId: meta.openId })
|
|
89
89
|
.add({ tag: 'GROUP_MESSAGE_CREATE' }).value);
|
|
90
90
|
});
|
|
91
|
+
client.on('GROUP_MEMBER_ADD', event => {
|
|
92
|
+
const UserId = event.op_member_openid ?? event.member_openid ?? '';
|
|
93
|
+
const [isMaster, UserKey] = getMaster(UserId);
|
|
94
|
+
cbp.send(FormatEvent.create('member.add')
|
|
95
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
96
|
+
.addGuild({ GuildId: event.group_openid ?? '', SpaceId: `GROUP:${event.group_openid ?? ''}` })
|
|
97
|
+
.addChannel({ ChannelId: event.group_openid ?? '' })
|
|
98
|
+
.addUser({ UserId: UserId, UserKey, UserName: event?.username ?? '', UserAvatar: createUserAvatarURL(UserId), IsMaster: isMaster, IsBot: false })
|
|
99
|
+
.add({ tag: 'GROUP_MEMBER_ADD' }).value);
|
|
100
|
+
});
|
|
101
|
+
client.on('GROUP_MEMBER_REMOVE', event => {
|
|
102
|
+
const UserId = event.op_member_openid ?? event.member_openid ?? '';
|
|
103
|
+
const [isMaster, UserKey] = getMaster(UserId);
|
|
104
|
+
cbp.send(FormatEvent.create('member.remove')
|
|
105
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
106
|
+
.addGuild({ GuildId: event.group_openid ?? '', SpaceId: `GROUP:${event.group_openid ?? ''}` })
|
|
107
|
+
.addChannel({ ChannelId: event.group_openid ?? '' })
|
|
108
|
+
.addUser({ UserId: UserId, UserKey, UserName: event?.username ?? '', UserAvatar: createUserAvatarURL(UserId), IsMaster: isMaster, IsBot: false })
|
|
109
|
+
.add({ tag: 'GROUP_MEMBER_REMOVE' }).value);
|
|
110
|
+
});
|
|
91
111
|
client.on('GROUP_AT_MESSAGE_CREATE', event => {
|
|
92
112
|
if (event?.author?.bot) {
|
|
93
113
|
return;
|
|
@@ -182,7 +202,7 @@ const register = (client) => {
|
|
|
182
202
|
let msg = event?.content ?? '';
|
|
183
203
|
if (event?.mentions) {
|
|
184
204
|
for (const item of event.mentions) {
|
|
185
|
-
if (
|
|
205
|
+
if (item?.id) {
|
|
186
206
|
msg = msg.replace(`<@!${item.id}>`, '').trim();
|
|
187
207
|
msg = msg.replace(`<@${item.id}>`, '').trim();
|
|
188
208
|
}
|
|
@@ -12,6 +12,8 @@ import { MESSAGE_AUDIT_REJECT_TYPE } from '../message/group/MESSAGE_AUDIT_REJECT
|
|
|
12
12
|
import { FRIEND_ADD_TYPE } from '../message/group/FRIEND_ADD';
|
|
13
13
|
import { FRIEND_DEL_TYPE } from '../message/group/FRIEND_DEL';
|
|
14
14
|
import { ERROR_TYPE } from '../message/ERROR';
|
|
15
|
+
import { GROUP_MEMBER_REMOVE } from '../message/group/GROUP_MEMBER_REMOVE';
|
|
16
|
+
import { GROUP_MEMBER_ADD } from '../message/group/GROUP_MEMBER_ADD';
|
|
15
17
|
export type QQBotGroupEventMap = {
|
|
16
18
|
C2C_MESSAGE_CREATE: C2C_MESSAGE_CREATE_TYPE;
|
|
17
19
|
C2C_MSG_REJECT: C2C_MSG_REJECT_TYPE;
|
|
@@ -27,4 +29,6 @@ export type QQBotGroupEventMap = {
|
|
|
27
29
|
FRIEND_ADD: FRIEND_ADD_TYPE;
|
|
28
30
|
FRIEND_DEL: FRIEND_DEL_TYPE;
|
|
29
31
|
ERROR: ERROR_TYPE;
|
|
32
|
+
GROUP_MEMBER_ADD: GROUP_MEMBER_ADD;
|
|
33
|
+
GROUP_MEMBER_REMOVE: GROUP_MEMBER_REMOVE;
|
|
30
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alemonjs/qq-bot",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.27",
|
|
4
4
|
"description": "阿柠檬qq-bot平台连接",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
}
|
|
47
47
|
],
|
|
48
48
|
"logo": "antd.QqOutlined",
|
|
49
|
-
"
|
|
49
|
+
"command": [
|
|
50
50
|
{
|
|
51
51
|
"name": "qq-bot",
|
|
52
52
|
"icon": "antd.QqOutlined",
|
|
53
|
-
"
|
|
53
|
+
"command": "open.qq-bot"
|
|
54
54
|
}
|
|
55
55
|
],
|
|
56
56
|
"sidebars": [
|
|
57
57
|
{
|
|
58
58
|
"name": "qq-bot",
|
|
59
59
|
"icon": "antd.QqOutlined",
|
|
60
|
-
"
|
|
60
|
+
"command": "open.qq-bot"
|
|
61
61
|
}
|
|
62
62
|
]
|
|
63
63
|
}
|