@alemonjs/qq-bot 2.1.5 → 2.1.7

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/hook.d.ts CHANGED
@@ -5,31 +5,57 @@ import { AT_MESSAGE_CREATE_TYPE } from './message/AT_MESSAGE_CREATE';
5
5
  import { INTERACTION_CREATE_TYPE } from './message/INTERACTION_CREATE';
6
6
  import { DIRECT_MESSAGE_CREATE_TYPE } from './message/DIRECT_MESSAGE_CREATE';
7
7
  import { C2C_MESSAGE_CREATE_TYPE } from './message/group/C2C_MESSAGE_CREATE';
8
+ import { MESSAGE_CREATE_TYPE } from './message/MESSAGE_CREATE';
9
+ import { MESSAGE_DELETE_TYPE } from './message/MESSAGE_DELETE';
10
+ import { PUBLIC_MESSAGE_DELETE_TYPE } from './message/PUBLIC_MESSAGE_DELETE';
11
+ import { DIRECT_MESSAGE_DELETE_TYPE } from './message/DIRECT_MESSAGE_DELETE';
12
+ import { MESSAGE_REACTION_ADD_TYPE } from './message/MESSAGE_REACTION_ADD';
13
+ import { MESSAGE_REACTION_REMOVE_TYPE } from './message/MESSAGE_REACTION_REMOVE';
14
+ import { CHANNEL_CREATE_TYPE } from './message/CHANNEL_CREATE';
15
+ import { CHANNEL_DELETE_TYPE } from './message/CHANNEL_DELETE';
16
+ import { CHANNEL_UPDATE_TYPE } from './message/CHANNEL_UPDATE';
17
+ import { GUILD_CREATE_TYPE } from './message/GUILD_CREATE';
18
+ import { GUILD_DELETE_TYPE } from './message/GUILD_DELETE';
19
+ import { GUILD_UPDATE_TYPE } from './message/GUILD_UPDATE';
20
+ import { GUILD_MEMBER_ADD_TYPE } from './message/GUILD_MEMBER_ADD';
21
+ import { GUILD_MEMBER_REMOVE_TYPE } from './message/GUILD_MEMBER_REMOVE';
22
+ import { GUILD_MEMBER_UPDATE_TYPE } from './message/GUILD_MEMBER_UPDATE';
23
+ import { GROUP_ADD_ROBOT_TYPE } from './message/group/GROUP_ADD_ROBOT';
24
+ import { GROUP_DEL_ROBOT_TYPE } from './message/group/GROUP_DEL_ROBOT';
25
+ import { FRIEND_ADD_TYPE } from './message/group/FRIEND_ADD';
26
+ import { FRIEND_DEL_TYPE } from './message/group/FRIEND_DEL';
27
+ import { GROUP_MSG_RECEIVE_TYPE } from './message/group/GROUP_MSG_RECEIVE';
28
+ import { GROUP_MSG_REJECT_TYPE } from './message/group/GROUP_MSG_REJECT';
29
+ import { C2C_MSG_RECEIVE_TYPE } from './message/group/C2C_MSG_RECEIVE';
30
+ import { C2C_MSG_REJECT_TYPE } from './message/group/C2C_MSG_REJECT';
8
31
  type MAP = {
9
- 'message.create': GROUP_AT_MESSAGE_CREATE_TYPE | AT_MESSAGE_CREATE_TYPE;
32
+ 'message.create': GROUP_AT_MESSAGE_CREATE_TYPE | AT_MESSAGE_CREATE_TYPE | MESSAGE_CREATE_TYPE;
10
33
  'private.message.create': DIRECT_MESSAGE_CREATE_TYPE | C2C_MESSAGE_CREATE_TYPE;
11
34
  'interaction.create': INTERACTION_CREATE_TYPE;
12
- 'private.interaction.create': undefined;
35
+ 'private.interaction.create': INTERACTION_CREATE_TYPE;
13
36
  'message.update': undefined;
14
- 'message.delete': undefined;
15
- 'message.reaction.add': undefined;
16
- 'message.reaction.remove': undefined;
37
+ 'message.delete': MESSAGE_DELETE_TYPE | PUBLIC_MESSAGE_DELETE_TYPE;
38
+ 'message.reaction.add': MESSAGE_REACTION_ADD_TYPE;
39
+ 'message.reaction.remove': MESSAGE_REACTION_REMOVE_TYPE;
17
40
  'message.pin': undefined;
18
- 'channel.create': undefined;
19
- 'channel.delete': undefined;
20
- 'channel.update': undefined;
21
- 'guild.join': undefined;
22
- 'guild.exit': undefined;
23
- 'guild.update': undefined;
24
- 'member.add': undefined;
25
- 'member.remove': undefined;
41
+ 'channel.create': CHANNEL_CREATE_TYPE;
42
+ 'channel.delete': CHANNEL_DELETE_TYPE;
43
+ 'channel.update': CHANNEL_UPDATE_TYPE;
44
+ 'guild.join': GUILD_CREATE_TYPE | GROUP_ADD_ROBOT_TYPE;
45
+ 'guild.exit': GUILD_DELETE_TYPE | GROUP_DEL_ROBOT_TYPE;
46
+ 'guild.update': GUILD_UPDATE_TYPE;
47
+ 'member.add': GUILD_MEMBER_ADD_TYPE;
48
+ 'member.remove': GUILD_MEMBER_REMOVE_TYPE;
26
49
  'member.ban': undefined;
27
50
  'member.unban': undefined;
51
+ 'member.update': GUILD_MEMBER_UPDATE_TYPE;
52
+ 'notice.create': GROUP_MSG_RECEIVE_TYPE | GROUP_MSG_REJECT_TYPE;
28
53
  'private.message.update': undefined;
29
- 'private.message.delete': undefined;
30
- 'private.friend.add': undefined;
31
- 'private.friend.remove': undefined;
54
+ 'private.message.delete': DIRECT_MESSAGE_DELETE_TYPE;
55
+ 'private.friend.add': FRIEND_ADD_TYPE;
56
+ 'private.friend.remove': FRIEND_DEL_TYPE;
32
57
  'private.guild.add': undefined;
58
+ 'private.notice.create': C2C_MSG_RECEIVE_TYPE | C2C_MSG_REJECT_TYPE;
33
59
  };
34
60
  export declare const useValue: <T extends EventKeys>(event: Events[T]) => readonly [MAP[T]];
35
61
  export declare const useClient: <T extends EventKeys>(event: Events[T]) => readonly [API, MAP[T]];
package/lib/register.js CHANGED
@@ -457,6 +457,28 @@ const register = (client) => {
457
457
  };
458
458
  cbp.send(e);
459
459
  });
460
+ client.on('GUILD_MEMBER_UPDATE', event => {
461
+ const UserId = event.user?.id ?? '';
462
+ const [isMaster, UserKey] = getMaster(UserId);
463
+ const e = {
464
+ name: 'member.update',
465
+ Platform: platform,
466
+ GuildId: event.guild_id ?? '',
467
+ ChannelId: '',
468
+ SpaceId: `GUILD:${event.guild_id ?? ''}`,
469
+ UserId: UserId,
470
+ UserKey,
471
+ UserName: event.user?.username ?? '',
472
+ UserAvatar: createUserAvatarURL(UserId),
473
+ IsMaster: isMaster,
474
+ IsBot: false,
475
+ MessageId: '',
476
+ BotId: botId,
477
+ _tag: 'GUILD_MEMBER_UPDATE',
478
+ value: event
479
+ };
480
+ cbp.send(e);
481
+ });
460
482
  client.on('FRIEND_ADD', event => {
461
483
  const e = {
462
484
  name: 'private.friend.add',
@@ -472,6 +494,119 @@ const register = (client) => {
472
494
  };
473
495
  cbp.send(e);
474
496
  });
497
+ client.on('FRIEND_DEL', event => {
498
+ const e = {
499
+ name: 'private.friend.remove',
500
+ Platform: platform,
501
+ UserId: event.openid ?? '',
502
+ UserKey: '',
503
+ IsMaster: false,
504
+ IsBot: false,
505
+ MessageId: '',
506
+ BotId: botId,
507
+ _tag: 'FRIEND_DEL',
508
+ value: event
509
+ };
510
+ cbp.send(e);
511
+ });
512
+ client.on('CHANNEL_UPDATE', event => {
513
+ const e = {
514
+ name: 'channel.update',
515
+ Platform: platform,
516
+ GuildId: event.guild_id ?? '',
517
+ ChannelId: event.id ?? '',
518
+ SpaceId: `GUILD:${event.guild_id ?? ''}`,
519
+ MessageId: '',
520
+ BotId: botId,
521
+ _tag: 'CHANNEL_UPDATE',
522
+ value: event
523
+ };
524
+ cbp.send(e);
525
+ });
526
+ client.on('GUILD_UPDATE', event => {
527
+ const e = {
528
+ name: 'guild.update',
529
+ Platform: platform,
530
+ GuildId: event.id ?? '',
531
+ ChannelId: '',
532
+ SpaceId: `GUILD:${event.id ?? ''}`,
533
+ MessageId: '',
534
+ BotId: botId,
535
+ _tag: 'GUILD_UPDATE',
536
+ value: event
537
+ };
538
+ cbp.send(e);
539
+ });
540
+ client.on('GROUP_MSG_RECEIVE', event => {
541
+ const e = {
542
+ name: 'notice.create',
543
+ Platform: platform,
544
+ GuildId: event.group_openid,
545
+ ChannelId: event.group_openid,
546
+ SpaceId: `GROUP:${event.group_openid}`,
547
+ UserId: event.op_member_openid,
548
+ UserKey: '',
549
+ IsMaster: false,
550
+ IsBot: false,
551
+ MessageId: `group_msg_receive_${event.group_openid}_${event.timestamp}`,
552
+ MessageText: '',
553
+ OpenId: `C2C:${event.op_member_openid}`,
554
+ BotId: botId,
555
+ _tag: 'GROUP_MSG_RECEIVE',
556
+ value: event
557
+ };
558
+ cbp.send(e);
559
+ });
560
+ client.on('GROUP_MSG_REJECT', event => {
561
+ const e = {
562
+ name: 'notice.create',
563
+ Platform: platform,
564
+ GuildId: event.group_openid,
565
+ ChannelId: event.group_openid,
566
+ SpaceId: `GROUP:${event.group_openid}`,
567
+ UserId: event.op_member_openid,
568
+ UserKey: '',
569
+ IsMaster: false,
570
+ IsBot: false,
571
+ MessageId: `group_msg_reject_${event.group_openid}_${event.timestamp}`,
572
+ MessageText: '',
573
+ OpenId: `C2C:${event.op_member_openid}`,
574
+ BotId: botId,
575
+ _tag: 'GROUP_MSG_REJECT',
576
+ value: event
577
+ };
578
+ cbp.send(e);
579
+ });
580
+ client.on('C2C_MSG_RECEIVE', event => {
581
+ const e = {
582
+ name: 'private.notice.create',
583
+ Platform: platform,
584
+ UserId: event.openid ?? '',
585
+ UserKey: '',
586
+ IsMaster: false,
587
+ IsBot: false,
588
+ MessageId: `c2c_msg_receive_${event.openid}_${event.timestamp}`,
589
+ BotId: botId,
590
+ _tag: 'C2C_MSG_RECEIVE',
591
+ value: event
592
+ };
593
+ cbp.send(e);
594
+ });
595
+ client.on('C2C_MSG_REJECT', event => {
596
+ const e = {
597
+ name: 'private.notice.create',
598
+ Platform: platform,
599
+ UserId: event.openid ?? '',
600
+ UserKey: '',
601
+ IsMaster: false,
602
+ IsBot: false,
603
+ MessageId: `c2c_msg_reject_${event.openid}_${event.timestamp}`,
604
+ BotId: botId,
605
+ _tag: 'C2C_MSG_REJECT',
606
+ value: event
607
+ };
608
+ cbp.send(e);
609
+ });
475
610
  client.on('ERROR', console.error);
476
611
  const api = {
477
612
  active: {
package/lib/sends.js CHANGED
@@ -86,15 +86,15 @@ const createArkListData = (value) => {
86
86
  };
87
87
  };
88
88
  const mdFormatters = {
89
- 'MD.title': value => `# ${value}`,
90
- 'MD.subtitle': value => `## ${value}`,
89
+ 'MD.title': value => `# ${value} `,
90
+ 'MD.subtitle': value => `## ${value} `,
91
91
  'MD.text': value => `${value} `,
92
92
  'MD.bold': value => `**${value}** `,
93
- 'MD.divider': () => '\n————————\n',
94
- 'MD.italic': value => `_${value}_ `,
93
+ 'MD.divider': () => '\n***\n',
94
+ 'MD.italic': value => `__${value}__ `,
95
95
  'MD.italicStar': value => `*${value}* `,
96
96
  'MD.strikethrough': value => `~~${value}~~ `,
97
- 'MD.blockquote': value => `\n> ${value}`,
97
+ 'MD.blockquote': value => `\n> ${value} `,
98
98
  'MD.newline': () => '\n',
99
99
  'MD.link': value => `[🔗${value.text}](${value.url}) `,
100
100
  'MD.image': (value, options) => `\n![text #${options?.width || 208}px #${options?.height || 320}px](${value})\n`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",