@alemonjs/qq-bot 2.1.18 → 2.1.20

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/config.d.ts CHANGED
@@ -7,4 +7,5 @@ export type Options = {
7
7
  hideUnsupported?: boolean | number;
8
8
  } & sdkOptions;
9
9
  export declare const getQQBotConfig: () => Options;
10
+ export declare const getIdentity: (UserId: string) => readonly [boolean, string];
10
11
  export declare const getMaster: (UserId: string) => readonly [boolean, string];
package/lib/config.js CHANGED
@@ -5,13 +5,16 @@ const getQQBotConfig = () => {
5
5
  const value = getConfigValue() || {};
6
6
  return value[platform] || {};
7
7
  };
8
- const getMaster = (UserId) => {
9
- const isMasterUser = isMaster(UserId, platform);
8
+ const getIdentity = (UserId) => {
9
+ const isMasterUser = UserId ? isMaster(UserId, platform) : false;
10
10
  const UserKey = createUserHashKey({
11
11
  Platform: platform,
12
12
  UserId
13
13
  });
14
14
  return [isMasterUser, UserKey];
15
15
  };
16
+ const getMaster = (UserId) => {
17
+ return getIdentity(UserId);
18
+ };
16
19
 
17
- export { getMaster, getQQBotConfig, platform };
20
+ export { getIdentity, getMaster, getQQBotConfig, platform };
package/lib/hook.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { EventKeys, Events } from 'alemonjs';
2
2
  import { GROUP_AT_MESSAGE_CREATE_TYPE } from './message/group/GROUP_AT_MESSAGE_CREATE';
3
+ import { GROUP_MESSAGE_CREATE_TYPE } from './message/group/GROUP_MESSAGE_CREATE';
3
4
  import { QQBotAPI as API } from './sdk/api';
4
5
  import { AT_MESSAGE_CREATE_TYPE } from './message/AT_MESSAGE_CREATE';
5
6
  import { INTERACTION_CREATE_TYPE } from './message/INTERACTION_CREATE';
@@ -28,8 +29,10 @@ import { GROUP_MSG_RECEIVE_TYPE } from './message/group/GROUP_MSG_RECEIVE';
28
29
  import { GROUP_MSG_REJECT_TYPE } from './message/group/GROUP_MSG_REJECT';
29
30
  import { C2C_MSG_RECEIVE_TYPE } from './message/group/C2C_MSG_RECEIVE';
30
31
  import { C2C_MSG_REJECT_TYPE } from './message/group/C2C_MSG_REJECT';
32
+ import { MESSAGE_AUDIT_PASS_TYPE } from './message/group/MESSAGE_AUDIT_PASS';
33
+ import { MESSAGE_AUDIT_REJECT_TYPE } from './message/group/MESSAGE_AUDIT_REJECT';
31
34
  type MAP = {
32
- 'message.create': GROUP_AT_MESSAGE_CREATE_TYPE | AT_MESSAGE_CREATE_TYPE | MESSAGE_CREATE_TYPE;
35
+ 'message.create': GROUP_AT_MESSAGE_CREATE_TYPE | GROUP_MESSAGE_CREATE_TYPE | AT_MESSAGE_CREATE_TYPE | MESSAGE_CREATE_TYPE;
33
36
  'private.message.create': DIRECT_MESSAGE_CREATE_TYPE | C2C_MESSAGE_CREATE_TYPE;
34
37
  'interaction.create': INTERACTION_CREATE_TYPE;
35
38
  'private.interaction.create': INTERACTION_CREATE_TYPE;
@@ -49,7 +52,7 @@ type MAP = {
49
52
  'member.ban': undefined;
50
53
  'member.unban': undefined;
51
54
  'member.update': GUILD_MEMBER_UPDATE_TYPE;
52
- 'notice.create': GROUP_MSG_RECEIVE_TYPE | GROUP_MSG_REJECT_TYPE;
55
+ 'notice.create': GROUP_MSG_RECEIVE_TYPE | GROUP_MSG_REJECT_TYPE | MESSAGE_AUDIT_PASS_TYPE | MESSAGE_AUDIT_REJECT_TYPE;
53
56
  'private.message.update': undefined;
54
57
  'private.message.delete': DIRECT_MESSAGE_DELETE_TYPE;
55
58
  'private.friend.add': FRIEND_ADD_TYPE;
package/lib/hook.js CHANGED
@@ -16,6 +16,9 @@ const useMode = (event) => {
16
16
  if (tag === 'GROUP_AT_MESSAGE_CREATE') {
17
17
  currentMode = 'group';
18
18
  }
19
+ if (tag === 'GROUP_MESSAGE_CREATE') {
20
+ currentMode = 'group';
21
+ }
19
22
  if (tag === 'C2C_MESSAGE_CREATE') {
20
23
  currentMode = 'c2c';
21
24
  }
@@ -1,12 +1,27 @@
1
1
  export interface GROUP_AT_MESSAGE_CREATE_TYPE {
2
2
  author: {
3
+ bot?: boolean;
3
4
  id: string;
4
5
  member_openid: string;
6
+ union_openid: string;
5
7
  username: string;
6
8
  };
7
9
  content: string;
8
10
  group_openid: string;
9
11
  group_id: string;
10
12
  id: string;
13
+ mentions?: {
14
+ bot?: boolean;
15
+ id: string;
16
+ is_you?: boolean;
17
+ member_openid?: string;
18
+ scope?: string;
19
+ username: string;
20
+ }[];
11
21
  timestamp: string;
22
+ message_scene: {
23
+ ext: string[];
24
+ source: string;
25
+ };
26
+ message_type: number;
12
27
  }
@@ -0,0 +1,27 @@
1
+ export interface GROUP_MESSAGE_CREATE_TYPE {
2
+ author: {
3
+ bot?: boolean;
4
+ id: string;
5
+ member_openid: string;
6
+ union_openid: string;
7
+ username: string;
8
+ };
9
+ content: string;
10
+ group_openid: string;
11
+ group_id: string;
12
+ id: string;
13
+ mentions?: {
14
+ bot?: boolean;
15
+ id: string;
16
+ is_you?: boolean;
17
+ member_openid?: string;
18
+ scope?: string;
19
+ username: string;
20
+ }[];
21
+ timestamp: string;
22
+ message_scene: {
23
+ ext: string[];
24
+ source: string;
25
+ };
26
+ message_type: number;
27
+ }
@@ -0,0 +1,7 @@
1
+ export type MESSAGE_AUDIT_PASS_TYPE = {
2
+ audit_id: string;
3
+ audit_time: string;
4
+ create_time?: string;
5
+ group_openid?: string;
6
+ message_id?: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ export type MESSAGE_AUDIT_REJECT_TYPE = {
2
+ audit_id: string;
3
+ audit_time: string;
4
+ create_time?: string;
5
+ group_openid?: string;
6
+ message_id?: string;
7
+ };
package/lib/register.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cbpPlatform, FormatEvent, ResultCode, createResult } from 'alemonjs';
2
2
  import { GROUP_AT_MESSAGE_CREATE, C2C_MESSAGE_CREATE, DIRECT_MESSAGE_CREATE, AT_MESSAGE_CREATE, MESSAGE_CREATE } from './sends.js';
3
- import { getQQBotConfig, platform, getMaster } from './config.js';
3
+ import { getQQBotConfig, platform, getMaster, getIdentity } from './config.js';
4
4
 
5
5
  const register = (client) => {
6
6
  const config = getQQBotConfig();
@@ -11,19 +11,50 @@ const register = (client) => {
11
11
  const createUserAvatarURL = (authorId) => {
12
12
  return `https://q.qlogo.cn/qqapp/${config.app_id}/${authorId}/640`;
13
13
  };
14
+ const getGroupMessageMeta = (event) => {
15
+ const author = event?.author;
16
+ const UserId = author?.id ?? '';
17
+ const memberOpenId = author?.member_openid ?? '';
18
+ const groupId = event?.group_id ?? event?.group_openid ?? '';
19
+ const messageId = event?.id ?? '';
20
+ const [isMaster, UserKey] = UserId ? getMaster(UserId) : [false, ''];
21
+ return {
22
+ UserId,
23
+ UserKey,
24
+ isMaster,
25
+ UserName: author?.username ?? '',
26
+ UserAvatar: UserId ? createUserAvatarURL(UserId) : '',
27
+ groupId,
28
+ messageId,
29
+ openId: memberOpenId ? `C2C:${memberOpenId}` : ''
30
+ };
31
+ };
32
+ const getGroupAuditMeta = (event) => {
33
+ const groupId = event?.group_openid ?? '';
34
+ const messageId = event?.message_id ?? event?.audit_id ?? '';
35
+ const auditTime = event?.audit_time ?? '';
36
+ return {
37
+ groupId,
38
+ messageId,
39
+ auditTime
40
+ };
41
+ };
42
+ const createUserMeta = (UserId, extra = {}) => {
43
+ const [IsMaster, UserKey] = getIdentity(UserId);
44
+ return {
45
+ UserId,
46
+ UserKey,
47
+ IsMaster,
48
+ IsBot: false,
49
+ ...extra
50
+ };
51
+ };
14
52
  client.on('GROUP_ADD_ROBOT', event => {
15
53
  cbp.send(FormatEvent.create('guild.join')
16
54
  .addPlatform({ Platform: platform, value: event, BotId: botId })
17
55
  .addGuild({ GuildId: event.group_openid, SpaceId: `GROUP:${event.group_openid}` })
18
56
  .addChannel({ ChannelId: event.group_openid })
19
- .addUser({
20
- UserId: event.op_member_openid,
21
- UserKey: event.op_member_openid,
22
- UserAvatar: createUserAvatarURL(event.op_member_openid),
23
- IsMaster: false,
24
- IsBot: false
25
- })
26
- .addMessage({ MessageId: '' })
57
+ .addUser(createUserMeta(event.op_member_openid, { UserAvatar: createUserAvatarURL(event.op_member_openid) }))
27
58
  .add({ tag: 'GROUP_ADD_ROBOT' }).value);
28
59
  });
29
60
  client.on('GROUP_DEL_ROBOT', event => {
@@ -31,35 +62,53 @@ const register = (client) => {
31
62
  .addPlatform({ Platform: platform, value: event, BotId: botId })
32
63
  .addGuild({ GuildId: event.group_openid, SpaceId: `GROUP:${event.group_openid}` })
33
64
  .addChannel({ ChannelId: event.group_openid })
65
+ .addUser(createUserMeta(event.op_member_openid, { UserAvatar: createUserAvatarURL(event.op_member_openid) }))
66
+ .add({ tag: 'GROUP_DEL_ROBOT' }).value);
67
+ });
68
+ client.on('GROUP_MESSAGE_CREATE', event => {
69
+ if (event?.author?.bot) {
70
+ return;
71
+ }
72
+ const msg = getMessageContent(event);
73
+ const meta = getGroupMessageMeta(event);
74
+ cbp.send(FormatEvent.create('message.create')
75
+ .addPlatform({ Platform: platform, value: event, BotId: botId })
76
+ .addGuild({ GuildId: meta.groupId, SpaceId: `GROUP:${meta.groupId}` })
77
+ .addChannel({ ChannelId: meta.groupId })
34
78
  .addUser({
35
- UserId: event.op_member_openid,
36
- UserKey: event.op_member_openid,
37
- UserAvatar: createUserAvatarURL(event.op_member_openid),
38
- IsMaster: false,
79
+ UserId: meta.UserId,
80
+ UserKey: meta.UserKey,
81
+ UserAvatar: meta.UserAvatar,
82
+ UserName: meta.UserName,
83
+ IsMaster: meta.isMaster,
39
84
  IsBot: false
40
85
  })
41
- .addMessage({ MessageId: '' })
42
- .add({ tag: 'GROUP_DEL_ROBOT' }).value);
86
+ .addMessage({ MessageId: meta.messageId })
87
+ .addText({ MessageText: msg?.trim() })
88
+ .addOpen({ OpenId: meta.openId })
89
+ .add({ tag: 'GROUP_MESSAGE_CREATE' }).value);
43
90
  });
44
91
  client.on('GROUP_AT_MESSAGE_CREATE', event => {
45
- const UserId = event.author.id;
46
- const [isMaster, UserKey] = getMaster(UserId);
47
- const UserAvatar = createUserAvatarURL(event.author.id);
92
+ if (event?.author?.bot) {
93
+ return;
94
+ }
95
+ const msg = getMessageContent(event);
96
+ const meta = getGroupMessageMeta(event);
48
97
  cbp.send(FormatEvent.create('message.create')
49
98
  .addPlatform({ Platform: platform, value: event, BotId: botId })
50
- .addGuild({ GuildId: event.group_id, SpaceId: `GROUP:${event.group_id}` })
51
- .addChannel({ ChannelId: event.group_id })
99
+ .addGuild({ GuildId: meta.groupId, SpaceId: `GROUP:${meta.groupId}` })
100
+ .addChannel({ ChannelId: meta.groupId })
52
101
  .addUser({
53
- UserId: event.author.id,
54
- UserKey,
55
- UserAvatar: UserAvatar,
56
- UserName: event?.author?.username,
57
- IsMaster: isMaster,
102
+ UserId: meta.UserId,
103
+ UserKey: meta.UserKey,
104
+ UserAvatar: meta.UserAvatar,
105
+ UserName: meta.UserName,
106
+ IsMaster: meta.isMaster,
58
107
  IsBot: false
59
108
  })
60
- .addMessage({ MessageId: event.id })
61
- .addText({ MessageText: event.content?.trim() })
62
- .addOpen({ OpenId: `C2C:${event.author.member_openid}` })
109
+ .addMessage({ MessageId: meta.messageId })
110
+ .addText({ MessageText: msg?.trim() })
111
+ .addOpen({ OpenId: meta.openId })
63
112
  .add({ tag: 'GROUP_AT_MESSAGE_CREATE' }).value);
64
113
  });
65
114
  client.on('C2C_MESSAGE_CREATE', event => {
@@ -285,7 +334,6 @@ const register = (client) => {
285
334
  .addPlatform({ Platform: platform, value: event, BotId: botId })
286
335
  .addGuild({ GuildId: event.guild_id ?? '', SpaceId: `GUILD:${event.guild_id ?? ''}` })
287
336
  .addChannel({ ChannelId: event.id ?? '' })
288
- .addMessage({ MessageId: '' })
289
337
  .add({ tag: 'CHANNEL_CREATE' }).value);
290
338
  });
291
339
  client.on('CHANNEL_DELETE', event => {
@@ -293,25 +341,20 @@ const register = (client) => {
293
341
  .addPlatform({ Platform: platform, value: event, BotId: botId })
294
342
  .addGuild({ GuildId: event.guild_id ?? '', SpaceId: `GUILD:${event.guild_id ?? ''}` })
295
343
  .addChannel({ ChannelId: event.id ?? '' })
296
- .addMessage({ MessageId: '' })
297
344
  .add({ tag: 'CHANNEL_DELETE' }).value);
298
345
  });
299
346
  client.on('GUILD_CREATE', event => {
300
347
  cbp.send(FormatEvent.create('guild.join')
301
348
  .addPlatform({ Platform: platform, value: event, BotId: botId })
302
349
  .addGuild({ GuildId: event.id ?? '', SpaceId: `GUILD:${event.id ?? ''}` })
303
- .addChannel({ ChannelId: '' })
304
350
  .addUser({ UserId: event.op_user_id ?? '', UserKey: '', IsMaster: false, IsBot: false })
305
- .addMessage({ MessageId: '' })
306
351
  .add({ tag: 'GUILD_CREATE' }).value);
307
352
  });
308
353
  client.on('GUILD_DELETE', event => {
309
354
  cbp.send(FormatEvent.create('guild.exit')
310
355
  .addPlatform({ Platform: platform, value: event, BotId: botId })
311
356
  .addGuild({ GuildId: event.id ?? '', SpaceId: `GUILD:${event.id ?? ''}` })
312
- .addChannel({ ChannelId: '' })
313
357
  .addUser({ UserId: event.op_user_id ?? '', UserKey: '', IsMaster: false, IsBot: false })
314
- .addMessage({ MessageId: '' })
315
358
  .add({ tag: 'GUILD_DELETE' }).value);
316
359
  });
317
360
  client.on('GUILD_MEMBER_ADD', event => {
@@ -320,9 +363,7 @@ const register = (client) => {
320
363
  cbp.send(FormatEvent.create('member.add')
321
364
  .addPlatform({ Platform: platform, value: event, BotId: botId })
322
365
  .addGuild({ GuildId: event.guild_id ?? '', SpaceId: `GUILD:${event.guild_id ?? ''}` })
323
- .addChannel({ ChannelId: '' })
324
366
  .addUser({ UserId: UserId, UserKey, UserName: event.user?.username ?? '', UserAvatar: createUserAvatarURL(UserId), IsMaster: isMaster, IsBot: false })
325
- .addMessage({ MessageId: '' })
326
367
  .add({ tag: 'GUILD_MEMBER_ADD' }).value);
327
368
  });
328
369
  client.on('GUILD_MEMBER_REMOVE', event => {
@@ -331,9 +372,7 @@ const register = (client) => {
331
372
  cbp.send(FormatEvent.create('member.remove')
332
373
  .addPlatform({ Platform: platform, value: event, BotId: botId })
333
374
  .addGuild({ GuildId: event.guild_id ?? '', SpaceId: `GUILD:${event.guild_id ?? ''}` })
334
- .addChannel({ ChannelId: '' })
335
375
  .addUser({ UserId: UserId, UserKey, UserName: event.user?.username ?? '', UserAvatar: createUserAvatarURL(UserId), IsMaster: isMaster, IsBot: false })
336
- .addMessage({ MessageId: '' })
337
376
  .add({ tag: 'GUILD_MEMBER_REMOVE' }).value);
338
377
  });
339
378
  client.on('GUILD_MEMBER_UPDATE', event => {
@@ -342,23 +381,19 @@ const register = (client) => {
342
381
  cbp.send(FormatEvent.create('member.update')
343
382
  .addPlatform({ Platform: platform, value: event, BotId: botId })
344
383
  .addGuild({ GuildId: event.guild_id ?? '', SpaceId: `GUILD:${event.guild_id ?? ''}` })
345
- .addChannel({ ChannelId: '' })
346
384
  .addUser({ UserId: UserId, UserKey, UserName: event.user?.username ?? '', UserAvatar: createUserAvatarURL(UserId), IsMaster: isMaster, IsBot: false })
347
- .addMessage({ MessageId: '' })
348
385
  .add({ tag: 'GUILD_MEMBER_UPDATE' }).value);
349
386
  });
350
387
  client.on('FRIEND_ADD', event => {
351
388
  cbp.send(FormatEvent.create('private.friend.add')
352
389
  .addPlatform({ Platform: platform, value: event, BotId: botId })
353
- .addUser({ UserId: event.openid ?? '', UserKey: '', IsMaster: false, IsBot: false })
354
- .addMessage({ MessageId: '' })
390
+ .addUser(createUserMeta(event.openid ?? ''))
355
391
  .add({ tag: 'FRIEND_ADD' }).value);
356
392
  });
357
393
  client.on('FRIEND_DEL', event => {
358
394
  cbp.send(FormatEvent.create('private.friend.remove')
359
395
  .addPlatform({ Platform: platform, value: event, BotId: botId })
360
- .addUser({ UserId: event.openid ?? '', UserKey: '', IsMaster: false, IsBot: false })
361
- .addMessage({ MessageId: '' })
396
+ .addUser(createUserMeta(event.openid ?? ''))
362
397
  .add({ tag: 'FRIEND_DEL' }).value);
363
398
  });
364
399
  client.on('CHANNEL_UPDATE', event => {
@@ -366,15 +401,12 @@ const register = (client) => {
366
401
  .addPlatform({ Platform: platform, value: event, BotId: botId })
367
402
  .addGuild({ GuildId: event.guild_id ?? '', SpaceId: `GUILD:${event.guild_id ?? ''}` })
368
403
  .addChannel({ ChannelId: event.id ?? '' })
369
- .addMessage({ MessageId: '' })
370
404
  .add({ tag: 'CHANNEL_UPDATE' }).value);
371
405
  });
372
406
  client.on('GUILD_UPDATE', event => {
373
407
  cbp.send(FormatEvent.create('guild.update')
374
408
  .addPlatform({ Platform: platform, value: event, BotId: botId })
375
409
  .addGuild({ GuildId: event.id ?? '', SpaceId: `GUILD:${event.id ?? ''}` })
376
- .addChannel({ ChannelId: '' })
377
- .addMessage({ MessageId: '' })
378
410
  .add({ tag: 'GUILD_UPDATE' }).value);
379
411
  });
380
412
  client.on('GROUP_MSG_RECEIVE', event => {
@@ -382,7 +414,7 @@ const register = (client) => {
382
414
  .addPlatform({ Platform: platform, value: event, BotId: botId })
383
415
  .addGuild({ GuildId: event.group_openid, SpaceId: `GROUP:${event.group_openid}` })
384
416
  .addChannel({ ChannelId: event.group_openid })
385
- .addUser({ UserId: event.op_member_openid, UserKey: '', IsMaster: false, IsBot: false })
417
+ .addUser(createUserMeta(event.op_member_openid))
386
418
  .addMessage({ MessageId: `group_msg_receive_${event.group_openid}_${event.timestamp}` })
387
419
  .add({ tag: 'GROUP_MSG_RECEIVE' }).value);
388
420
  });
@@ -391,21 +423,39 @@ const register = (client) => {
391
423
  .addPlatform({ Platform: platform, value: event, BotId: botId })
392
424
  .addGuild({ GuildId: event.group_openid, SpaceId: `GROUP:${event.group_openid}` })
393
425
  .addChannel({ ChannelId: event.group_openid })
394
- .addUser({ UserId: event.op_member_openid, UserKey: '', IsMaster: false, IsBot: false })
426
+ .addUser(createUserMeta(event.op_member_openid))
395
427
  .addMessage({ MessageId: `group_msg_reject_${event.group_openid}_${event.timestamp}` })
396
428
  .add({ tag: 'GROUP_MSG_REJECT' }).value);
397
429
  });
430
+ client.on('MESSAGE_AUDIT_PASS', event => {
431
+ const meta = getGroupAuditMeta(event);
432
+ cbp.send(FormatEvent.create('notice.create')
433
+ .addPlatform({ Platform: platform, value: event, BotId: botId })
434
+ .addGuild({ GuildId: meta.groupId, SpaceId: `GROUP:${meta.groupId}` })
435
+ .addChannel({ ChannelId: meta.groupId })
436
+ .addMessage({ MessageId: meta.messageId })
437
+ .add({ tag: 'MESSAGE_AUDIT_PASS' }).value);
438
+ });
439
+ client.on('MESSAGE_AUDIT_REJECT', event => {
440
+ const meta = getGroupAuditMeta(event);
441
+ cbp.send(FormatEvent.create('notice.create')
442
+ .addPlatform({ Platform: platform, value: event, BotId: botId })
443
+ .addGuild({ GuildId: meta.groupId, SpaceId: `GROUP:${meta.groupId}` })
444
+ .addChannel({ ChannelId: meta.groupId })
445
+ .addMessage({ MessageId: meta.messageId })
446
+ .add({ tag: 'MESSAGE_AUDIT_REJECT' }).value);
447
+ });
398
448
  client.on('C2C_MSG_RECEIVE', event => {
399
449
  cbp.send(FormatEvent.create('private.notice.create')
400
450
  .addPlatform({ Platform: platform, value: event, BotId: botId })
401
- .addUser({ UserId: event.openid ?? '', UserKey: '', IsMaster: false, IsBot: false })
451
+ .addUser(createUserMeta(event.openid ?? ''))
402
452
  .addMessage({ MessageId: `c2c_msg_receive_${event.openid}_${event.timestamp}` })
403
453
  .add({ tag: 'C2C_MSG_RECEIVE' }).value);
404
454
  });
405
455
  client.on('C2C_MSG_REJECT', event => {
406
456
  cbp.send(FormatEvent.create('private.notice.create')
407
457
  .addPlatform({ Platform: platform, value: event, BotId: botId })
408
- .addUser({ UserId: event.openid ?? '', UserKey: '', IsMaster: false, IsBot: false })
458
+ .addUser(createUserMeta(event.openid ?? ''))
409
459
  .addMessage({ MessageId: `c2c_msg_reject_${event.openid}_${event.timestamp}` })
410
460
  .add({ tag: 'C2C_MSG_REJECT' }).value);
411
461
  });
@@ -460,6 +510,9 @@ const register = (client) => {
460
510
  if (tag === 'GROUP_AT_MESSAGE_CREATE') {
461
511
  return await GROUP_AT_MESSAGE_CREATE(client, event, val);
462
512
  }
513
+ if (tag === 'GROUP_MESSAGE_CREATE') {
514
+ return await GROUP_AT_MESSAGE_CREATE(client, event, val);
515
+ }
463
516
  if (tag === 'C2C_MESSAGE_CREATE') {
464
517
  return await C2C_MESSAGE_CREATE(client, event, val);
465
518
  }
@@ -485,13 +538,9 @@ const register = (client) => {
485
538
  },
486
539
  mention: event => {
487
540
  const value = event.value || {};
488
- const tag = event._tag;
489
541
  const Metions = [];
490
- if (tag === 'GROUP_AT_MESSAGE_CREATE' || tag === 'C2C_MESSAGE_CREATE') {
491
- return new Promise(resolve => resolve(Metions));
492
- }
493
542
  if (value.mentions) {
494
- const mentions = event.value['mentions'];
543
+ const mentions = (event.value['mentions'] || []);
495
544
  const MessageMention = mentions.map(item => {
496
545
  const UserId = item.id;
497
546
  const [isMaster, UserKey] = getMaster(UserId);
@@ -499,7 +548,7 @@ const register = (client) => {
499
548
  UserId: item.id,
500
549
  IsMaster: isMaster,
501
550
  UserName: item.username,
502
- IsBot: item.bot,
551
+ IsBot: item.bot ?? false,
503
552
  UserKey: UserKey
504
553
  };
505
554
  });
@@ -3,9 +3,12 @@ import { C2C_MSG_REJECT_TYPE } from '../message/group/C2C_MSG_REJECT';
3
3
  import { C2C_MSG_RECEIVE_TYPE } from '../message/group/C2C_MSG_RECEIVE';
4
4
  import { GROUP_ADD_ROBOT_TYPE } from '../message/group/GROUP_ADD_ROBOT';
5
5
  import { GROUP_AT_MESSAGE_CREATE_TYPE } from '../message/group/GROUP_AT_MESSAGE_CREATE';
6
+ import { GROUP_MESSAGE_CREATE_TYPE } from '../message/group/GROUP_MESSAGE_CREATE';
6
7
  import { GROUP_DEL_ROBOT_TYPE } from '../message/group/GROUP_DEL_ROBOT';
7
8
  import { GROUP_MSG_RECEIVE_TYPE } from '../message/group/GROUP_MSG_RECEIVE';
8
9
  import { GROUP_MSG_REJECT_TYPE } from '../message/group/GROUP_MSG_REJECT';
10
+ import { MESSAGE_AUDIT_PASS_TYPE } from '../message/group/MESSAGE_AUDIT_PASS';
11
+ import { MESSAGE_AUDIT_REJECT_TYPE } from '../message/group/MESSAGE_AUDIT_REJECT';
9
12
  import { FRIEND_ADD_TYPE } from '../message/group/FRIEND_ADD';
10
13
  import { FRIEND_DEL_TYPE } from '../message/group/FRIEND_DEL';
11
14
  import { ERROR_TYPE } from '../message/ERROR';
@@ -15,9 +18,12 @@ export type QQBotGroupEventMap = {
15
18
  C2C_MSG_RECEIVE: C2C_MSG_RECEIVE_TYPE;
16
19
  GROUP_ADD_ROBOT: GROUP_ADD_ROBOT_TYPE;
17
20
  GROUP_AT_MESSAGE_CREATE: GROUP_AT_MESSAGE_CREATE_TYPE;
21
+ GROUP_MESSAGE_CREATE: GROUP_MESSAGE_CREATE_TYPE;
18
22
  GROUP_DEL_ROBOT: GROUP_DEL_ROBOT_TYPE;
19
23
  GROUP_MSG_RECEIVE: GROUP_MSG_RECEIVE_TYPE;
20
24
  GROUP_MSG_REJECT: GROUP_MSG_REJECT_TYPE;
25
+ MESSAGE_AUDIT_PASS: MESSAGE_AUDIT_PASS_TYPE;
26
+ MESSAGE_AUDIT_REJECT: MESSAGE_AUDIT_REJECT_TYPE;
21
27
  FRIEND_ADD: FRIEND_ADD_TYPE;
22
28
  FRIEND_DEL: FRIEND_DEL_TYPE;
23
29
  ERROR: ERROR_TYPE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.18",
3
+ "version": "2.1.20",
4
4
  "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",