@alemonjs/qq-bot 0.0.20 → 0.0.22

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.
@@ -11,22 +11,24 @@ var QQBotGuild = definePlatform(() => {
11
11
  // intents 需要默认值
12
12
  const client = new QQBotGuildClient({
13
13
  app_id: config?.app_id,
14
- intents: config?.intents ?? config?.is_private ? [
15
- 'GUILDS', // base
16
- 'GUILD_MEMBERS', // base
17
- 'GUILD_MESSAGES',
18
- 'GUILD_MESSAGE_REACTIONS',
19
- 'DIRECT_MESSAGE',
20
- 'INTERACTION',
21
- 'FORUMS_EVENT',
22
- ] : [
23
- 'GUILDS', // base
24
- 'GUILD_MEMBERS', // base
25
- 'GUILD_MESSAGE_REACTIONS',
26
- 'DIRECT_MESSAGE',
27
- 'INTERACTION',
28
- 'PUBLIC_GUILD_MESSAGES',
29
- ],
14
+ intents: config?.intents ?? config?.is_private
15
+ ? [
16
+ 'GUILDS', // base
17
+ 'GUILD_MEMBERS', // base
18
+ 'GUILD_MESSAGES',
19
+ 'GUILD_MESSAGE_REACTIONS',
20
+ 'DIRECT_MESSAGE',
21
+ 'INTERACTION',
22
+ 'FORUMS_EVENT'
23
+ ]
24
+ : [
25
+ 'GUILDS', // base
26
+ 'GUILD_MEMBERS', // base
27
+ 'GUILD_MESSAGE_REACTIONS',
28
+ 'DIRECT_MESSAGE',
29
+ 'INTERACTION',
30
+ 'PUBLIC_GUILD_MESSAGES'
31
+ ],
30
32
  is_private: config?.is_private ?? false,
31
33
  sandbox: config?.sandbox ?? false,
32
34
  secret: config?.secret,
package/lib/index.js CHANGED
@@ -47,23 +47,25 @@ var index = definePlatform(() => {
47
47
  }
48
48
  const client = new QQBotClients({
49
49
  app_id: config?.app_id,
50
- intents: config?.intents ?? config?.is_private ? [
51
- 'GUILDS', // base
52
- 'GUILD_MEMBERS', // base
53
- 'GUILD_MESSAGES',
54
- 'GUILD_MESSAGE_REACTIONS',
55
- 'DIRECT_MESSAGE',
56
- 'INTERACTION',
57
- 'FORUMS_EVENT',
58
- ] : [
59
- 'GUILDS', // base
60
- 'GUILD_MEMBERS', // base
61
- 'GUILD_MESSAGE_REACTIONS',
62
- 'DIRECT_MESSAGE',
63
- 'INTERACTION',
64
- 'PUBLIC_GUILD_MESSAGES',
65
- 'GROUP_AND_C2C_EVENT',
66
- ],
50
+ intents: config?.intents ?? config?.is_private
51
+ ? [
52
+ 'GUILDS', // base
53
+ 'GUILD_MEMBERS', // base
54
+ 'GUILD_MESSAGES',
55
+ 'GUILD_MESSAGE_REACTIONS',
56
+ 'DIRECT_MESSAGE',
57
+ 'INTERACTION',
58
+ 'FORUMS_EVENT'
59
+ ]
60
+ : [
61
+ 'GUILDS', // base
62
+ 'GUILD_MEMBERS', // base
63
+ 'GUILD_MESSAGE_REACTIONS',
64
+ 'DIRECT_MESSAGE',
65
+ 'INTERACTION',
66
+ 'PUBLIC_GUILD_MESSAGES',
67
+ 'GROUP_AND_C2C_EVENT'
68
+ ],
67
69
  is_private: config?.is_private ?? false,
68
70
  sandbox: config?.sandbox ?? false,
69
71
  secret: config?.secret,
package/lib/register.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getConfigValue, useUserHashKey, onProcessor } from 'alemonjs';
2
- import { AT_MESSAGE_CREATE, GROUP_AT_MESSAGE_CREATE, DIRECT_MESSAGE_CREATE, C2C_MESSAGE_CREATE, MESSAGE_CREATE } from './send/index.js';
2
+ import { AT_MESSAGE_CREATE, GROUP_AT_MESSAGE_CREATE, DIRECT_MESSAGE_CREATE, C2C_MESSAGE_CREATE, MESSAGE_CREATE } from './sends.js';
3
3
  import { isGuild } from './utils.js';
4
4
 
5
5
  const platform = 'qq-bot';
@@ -337,35 +337,30 @@ const createClientAPI = (client) => {
337
337
  use: {
338
338
  send: async (event, val) => {
339
339
  if (val.length < 0)
340
- ;
340
+ Promise.all([]);
341
341
  // 打 tag
342
342
  const tag = event.tag;
343
- try {
344
- // 群at
345
- if (tag == 'GROUP_AT_MESSAGE_CREATE') {
346
- return await GROUP_AT_MESSAGE_CREATE(client, event, val);
347
- }
348
- // 私聊
349
- if (tag == 'C2C_MESSAGE_CREATE') {
350
- return await C2C_MESSAGE_CREATE(client, event, val);
351
- }
352
- // 频道私聊
353
- if (tag == 'DIRECT_MESSAGE_CREATE') {
354
- return await DIRECT_MESSAGE_CREATE(client, event, val);
355
- }
356
- // 频道at
357
- if (tag == 'AT_MESSAGE_CREATE') {
358
- return await AT_MESSAGE_CREATE(client, event, val);
359
- }
360
- // 频道消息
361
- if (tag == 'MESSAGE_CREATE') {
362
- return await MESSAGE_CREATE(client, event, val);
363
- }
343
+ // 群at
344
+ if (tag == 'GROUP_AT_MESSAGE_CREATE') {
345
+ return await GROUP_AT_MESSAGE_CREATE(client, event, val);
346
+ }
347
+ // 私聊
348
+ if (tag == 'C2C_MESSAGE_CREATE') {
349
+ return await C2C_MESSAGE_CREATE(client, event, val);
350
+ }
351
+ // 频道私聊
352
+ if (tag == 'DIRECT_MESSAGE_CREATE') {
353
+ return await DIRECT_MESSAGE_CREATE(client, event, val);
354
+ }
355
+ // 频道at
356
+ if (tag == 'AT_MESSAGE_CREATE') {
357
+ return await AT_MESSAGE_CREATE(client, event, val);
364
358
  }
365
- catch (error) {
366
- return [error];
359
+ // 频道消息
360
+ if (tag == 'MESSAGE_CREATE') {
361
+ return await MESSAGE_CREATE(client, event, val);
367
362
  }
368
- return [];
363
+ return Promise.all([]);
369
364
  },
370
365
  mention: async (e) => {
371
366
  const event = e.value;
@@ -73,16 +73,16 @@ PUBLIC_GUILD_MESSAGES (1 << 30) // 消息事件,此为公域的消息事件
73
73
  const intentsMap = {
74
74
  GUILDS: 1 << 0, // 频道事件
75
75
  GUILD_MEMBERS: 1 << 1, // 成员
76
- GUILD_MESSAGES: 1 << 9, // 消息事件,仅 *私域*
76
+ GUILD_MESSAGES: 1 << 9, // 消息事件,仅 *私域*
77
77
  GUILD_MESSAGE_REACTIONS: 1 << 10, // 消息表情表态
78
78
  DIRECT_MESSAGE: 1 << 12, // 私信消息
79
79
  INTERACTION: 1 << 26, // 互动事件
80
80
  // INTERACTION_CREATE: 1 << 26,
81
81
  MESSAGE_AUDIT: 1 << 27, // 消息审核
82
82
  FORUMS_EVENT: 1 << 28, // 论坛事件,仅 *私域*
83
- AUDIO_ACTION: 1 << 29, // 音频
83
+ AUDIO_ACTION: 1 << 29, // 音频
84
84
  PUBLIC_GUILD_MESSAGES: 1 << 30, // 消息事件,此为公域的消息事件
85
- GROUP_AND_C2C_EVENT: 1 << 25, // group all
85
+ GROUP_AND_C2C_EVENT: 1 << 25 // group all
86
86
  };
87
87
  /**
88
88
  *