@alemonjs/qq-bot 2.1.0-alpha.19 → 2.1.0-alpha.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.
Files changed (101) hide show
  1. package/lib/config.d.ts +8 -3
  2. package/lib/desktop.d.ts +1 -3
  3. package/lib/desktop.js +0 -10
  4. package/lib/hook.d.ts +12 -29
  5. package/lib/hook.js +0 -20
  6. package/lib/index.d.ts +4 -6
  7. package/lib/index.js +2 -5
  8. package/lib/index.webhook.d.ts +1 -0
  9. package/lib/index.webhook.js +0 -1
  10. package/lib/index.websoket.d.ts +1 -0
  11. package/lib/index.websoket.js +4 -5
  12. package/lib/message/AT_MESSAGE_CREATE.d.ts +1 -3
  13. package/lib/message/AT_MESSAGE_CREATE.js +1 -0
  14. package/lib/message/CHANNEL_CREATE.d.ts +15 -0
  15. package/lib/message/CHANNEL_CREATE.js +1 -0
  16. package/lib/message/CHANNEL_DELETE.d.ts +15 -0
  17. package/lib/message/CHANNEL_DELETE.js +1 -0
  18. package/lib/message/CHANNEL_UPDATE.d.ts +15 -0
  19. package/lib/message/CHANNEL_UPDATE.js +1 -0
  20. package/lib/message/DIRECT_MESSAGE_CREATE.d.ts +1 -8
  21. package/lib/message/DIRECT_MESSAGE_CREATE.js +1 -0
  22. package/lib/message/DIRECT_MESSAGE_DELETE.d.ts +17 -0
  23. package/lib/message/DIRECT_MESSAGE_DELETE.js +1 -0
  24. package/lib/message/ERROR.d.ts +1 -0
  25. package/lib/message/ERROR.js +1 -0
  26. package/lib/message/GUILD_CREATE.d.ts +15 -0
  27. package/lib/message/GUILD_CREATE.js +1 -0
  28. package/lib/message/GUILD_DELETE.d.ts +15 -0
  29. package/lib/message/GUILD_DELETE.js +1 -0
  30. package/lib/message/GUILD_MEMBER_ADD.d.ts +14 -0
  31. package/lib/message/GUILD_MEMBER_ADD.js +1 -0
  32. package/lib/message/GUILD_MEMBER_REMOVE.d.ts +14 -0
  33. package/lib/message/GUILD_MEMBER_REMOVE.js +1 -0
  34. package/lib/message/GUILD_MEMBER_UPDATE.d.ts +14 -0
  35. package/lib/message/GUILD_MEMBER_UPDATE.js +1 -0
  36. package/lib/message/GUILD_UPDATE.d.ts +15 -0
  37. package/lib/message/GUILD_UPDATE.js +1 -0
  38. package/lib/message/INTERACTION_CREATE.d.ts +1 -8
  39. package/lib/message/INTERACTION_CREATE.js +1 -0
  40. package/lib/message/MESSAGE_CREATE.d.ts +1 -0
  41. package/lib/message/MESSAGE_CREATE.js +1 -0
  42. package/lib/message/MESSAGE_DELETE.d.ts +1 -0
  43. package/lib/message/MESSAGE_DELETE.js +1 -0
  44. package/lib/message/MESSAGE_REACTION_ADD.d.ts +13 -0
  45. package/lib/message/MESSAGE_REACTION_ADD.js +1 -0
  46. package/lib/message/MESSAGE_REACTION_REMOVE.d.ts +13 -0
  47. package/lib/message/MESSAGE_REACTION_REMOVE.js +1 -0
  48. package/lib/message/PUBLIC_MESSAGE_DELETE.d.ts +15 -0
  49. package/lib/message/PUBLIC_MESSAGE_DELETE.js +1 -0
  50. package/lib/message/READY.d.ts +6 -0
  51. package/lib/message/READY.js +1 -0
  52. package/lib/message/group/C2C_MESSAGE_CREATE.d.ts +1 -3
  53. package/lib/message/group/C2C_MESSAGE_CREATE.js +1 -0
  54. package/lib/message/group/C2C_MSG_RECEIVE.d.ts +4 -0
  55. package/lib/message/group/C2C_MSG_RECEIVE.js +1 -0
  56. package/lib/message/group/C2C_MSG_REJECT.d.ts +4 -0
  57. package/lib/message/group/C2C_MSG_REJECT.js +1 -0
  58. package/lib/message/group/FRIEND_ADD.d.ts +4 -0
  59. package/lib/message/group/FRIEND_ADD.js +1 -0
  60. package/lib/message/group/FRIEND_DEL.d.ts +4 -0
  61. package/lib/message/group/FRIEND_DEL.js +1 -0
  62. package/lib/message/group/GROUP_ADD_ROBOT.d.ts +5 -0
  63. package/lib/message/group/GROUP_ADD_ROBOT.js +1 -0
  64. package/lib/message/group/GROUP_AT_MESSAGE_CREATE.d.ts +1 -6
  65. package/lib/message/group/GROUP_AT_MESSAGE_CREATE.js +1 -0
  66. package/lib/message/group/GROUP_DEL_ROBOT.d.ts +5 -0
  67. package/lib/message/group/GROUP_DEL_ROBOT.js +1 -0
  68. package/lib/message/group/GROUP_MSG_RECEIVE.d.ts +5 -0
  69. package/lib/message/group/GROUP_MSG_RECEIVE.js +1 -0
  70. package/lib/message/group/GROUP_MSG_REJECT.d.ts +5 -0
  71. package/lib/message/group/GROUP_MSG_REJECT.js +1 -0
  72. package/lib/register.d.ts +2 -0
  73. package/lib/register.js +0 -97
  74. package/lib/sdk/api.d.ts +6 -529
  75. package/lib/sdk/api.js +0 -526
  76. package/lib/sdk/client.webhook.d.ts +9 -0
  77. package/lib/sdk/client.webhook.js +0 -39
  78. package/lib/sdk/client.websoket.d.ts +9 -0
  79. package/lib/sdk/client.websoket.js +4 -57
  80. package/lib/sdk/config.d.ts +1 -0
  81. package/lib/sdk/instance.d.ts +3 -0
  82. package/lib/sdk/instance.js +3 -19
  83. package/lib/sdk/intents.d.ts +3 -0
  84. package/lib/sdk/intents.js +25 -90
  85. package/lib/sdk/message.d.ts +4 -0
  86. package/lib/sdk/message.group.d.ts +24 -0
  87. package/lib/sdk/message.group.js +1 -0
  88. package/lib/sdk/message.guild.d.ts +38 -0
  89. package/lib/sdk/message.guild.js +1 -0
  90. package/lib/sdk/message.js +1 -0
  91. package/lib/sdk/message.public.d.ts +6 -0
  92. package/lib/sdk/message.public.js +1 -0
  93. package/lib/sdk/typing.d.ts +21 -11
  94. package/lib/sdk/typing.js +1 -0
  95. package/lib/sdk/webhook.secret.d.ts +14 -0
  96. package/lib/sdk/webhook.secret.js +2 -19
  97. package/lib/sends.d.ts +29 -0
  98. package/lib/sends.js +19 -107
  99. package/lib/utils.d.ts +1 -0
  100. package/lib/utils.js +8 -0
  101. package/package.json +4 -4
@@ -0,0 +1 @@
1
+
@@ -1,6 +1,7 @@
1
- type MessageType = 0 | 1 | 2 | 3 | 4 | 7;
2
- type FileType = 1 | 2 | 3 | 4;
3
- interface ButtonType {
1
+ import { IntentsEnum } from './intents';
2
+ export type MessageType = 0 | 1 | 2 | 3 | 4 | 7;
3
+ export type FileType = 1 | 2 | 3 | 4;
4
+ export interface ButtonType {
4
5
  id: string;
5
6
  render_data: {
6
7
  label: string;
@@ -23,7 +24,7 @@ interface ButtonType {
23
24
  at_bot_show_channel_list?: boolean;
24
25
  };
25
26
  }
26
- interface KeyboardType {
27
+ export interface KeyboardType {
27
28
  id?: string;
28
29
  content?: {
29
30
  rows: {
@@ -31,18 +32,15 @@ interface KeyboardType {
31
32
  }[];
32
33
  };
33
34
  }
34
- interface MarkdownType {
35
- /** markdown 模版id,申请模版后获得 */
35
+ export interface MarkdownType {
36
36
  custom_template_id?: string;
37
- /** 原生 markdown 文本内容(内邀使用) */
38
37
  content?: string;
39
- /** 模版内变量与填充值的kv映射 */
40
38
  params?: Array<{
41
39
  key: string;
42
40
  values: string[];
43
41
  }>;
44
42
  }
45
- interface ApiRequestData {
43
+ export interface ApiRequestData {
46
44
  content?: string;
47
45
  msg_type: MessageType;
48
46
  markdown?: MarkdownType;
@@ -57,5 +55,17 @@ interface ApiRequestData {
57
55
  msg_id?: string;
58
56
  msg_seq?: number;
59
57
  }
60
-
61
- export type { ApiRequestData, ButtonType, FileType, KeyboardType, MarkdownType, MessageType };
58
+ export interface Options {
59
+ app_id: string;
60
+ token: string;
61
+ secret: string;
62
+ shard?: number[];
63
+ intents?: IntentsEnum[];
64
+ is_private?: boolean;
65
+ sandbox?: boolean;
66
+ mode?: 'guild' | 'group' | '';
67
+ route?: string;
68
+ port?: string;
69
+ ws?: string;
70
+ gatewayURL?: string;
71
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,14 @@
1
+ export declare class WebhookAPI {
2
+ config: {
3
+ secret: string;
4
+ };
5
+ constructor(config: {
6
+ secret: string;
7
+ });
8
+ validSign(ts: any, body: any, sign: any): boolean;
9
+ getSign(eventTs: any, plainToken: any): string;
10
+ getKey(): {
11
+ privateKey: Buffer<ArrayBuffer>;
12
+ publicKey: Uint8Array<ArrayBufferLike>;
13
+ };
14
+ }
@@ -5,13 +5,6 @@ class WebhookAPI {
5
5
  constructor(config) {
6
6
  this.config = config;
7
7
  }
8
- /**
9
- * 验证签名
10
- * @param ts
11
- * @param body
12
- * @param sign
13
- * @returns
14
- */
15
8
  validSign(ts, body, sign) {
16
9
  const { publicKey } = this.getKey();
17
10
  const sig = Buffer.isBuffer(sign) ? sign : Buffer.from(sign, 'hex');
@@ -19,22 +12,12 @@ class WebhookAPI {
19
12
  const msg = Buffer.from(ts + httpBody);
20
13
  return ed25519.verify(sig, msg, publicKey);
21
14
  }
22
- /**
23
- * 生成签名
24
- * @param eventTs
25
- * @param plainToken
26
- * @returns
27
- */
28
15
  getSign(eventTs, plainToken) {
29
16
  const { privateKey } = this.getKey();
30
17
  const msg = Buffer.from(eventTs + plainToken);
31
18
  const signature = Buffer.from(ed25519.sign(msg, privateKey)).toString('hex');
32
19
  return signature;
33
20
  }
34
- /**
35
- * 获取 key
36
- * @returns
37
- */
38
21
  getKey() {
39
22
  let seed = this.config.secret;
40
23
  if (!seed) {
@@ -42,8 +25,8 @@ class WebhookAPI {
42
25
  }
43
26
  while (seed.length < 32) {
44
27
  seed = seed.repeat(2);
45
- } // Ed25519 的种子大小是 32 字节
46
- seed = seed.slice(0, 32); // 修剪到 32 字节
28
+ }
29
+ seed = seed.slice(0, 32);
47
30
  const privateKey = Buffer.from(seed);
48
31
  return {
49
32
  privateKey,
package/lib/sends.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { QQBotAPI } from './sdk/api';
2
+ import { ClientAPIMessageResult, type DataEnums } from 'alemonjs';
3
+ type Client = typeof QQBotAPI.prototype;
4
+ export declare const GROUP_AT_MESSAGE_CREATE: (client: Client, event: {
5
+ ChannelId: string;
6
+ MessageId?: string;
7
+ tag?: string;
8
+ }, val: DataEnums[]) => Promise<ClientAPIMessageResult[]>;
9
+ export declare const C2C_MESSAGE_CREATE: (client: Client, event: {
10
+ UserId: string;
11
+ MessageId?: string;
12
+ tag?: string;
13
+ }, val: DataEnums[]) => Promise<ClientAPIMessageResult[]>;
14
+ export declare const DIRECT_MESSAGE_CREATE: (client: Client, event: {
15
+ UserId: string;
16
+ MessageId?: string;
17
+ tag?: string;
18
+ }, val: DataEnums[]) => Promise<ClientAPIMessageResult[]>;
19
+ export declare const MESSAGE_CREATE: (client: Client, event: {
20
+ ChannelId: string;
21
+ MessageId?: string;
22
+ tag?: string;
23
+ }, val: DataEnums[]) => Promise<ClientAPIMessageResult[]>;
24
+ export declare const AT_MESSAGE_CREATE: (client: Client, event: {
25
+ ChannelId: string;
26
+ MessageId?: string;
27
+ tag?: string;
28
+ }, val: DataEnums[]) => Promise<ClientAPIMessageResult[]>;
29
+ export {};
package/lib/sends.js CHANGED
@@ -26,17 +26,12 @@ const createButtonsData = (rows) => {
26
26
  style: 0
27
27
  },
28
28
  action: {
29
- // 0 link 1 callback , 2 command
30
29
  type: map[typing],
31
30
  permission: {
32
- // 所有人
33
31
  type: 2
34
- // "specify_role_ids": ["1", "2", "3"]
35
32
  },
36
- // "click_limit": 10,
37
33
  unsupport_tips: options?.toolTip ?? '',
38
34
  data: options?.data ?? '',
39
- // reply: true,
40
35
  at_bot_show_channel_list: options.showList ?? false,
41
36
  enter: options?.autoEnter ?? false
42
37
  }
@@ -153,72 +148,41 @@ const createArkList = (value) => {
153
148
  ]
154
149
  };
155
150
  };
156
- // 数据md转为文本
151
+ const map = {
152
+ title: (value) => `# ${value}`,
153
+ subtitle: (value) => `## ${value}`,
154
+ text: (value) => `${value} `,
155
+ bold: (value) => `**${value}** `,
156
+ divider: () => '\n————————\n',
157
+ italic: (value) => `_${value}_ `,
158
+ italicStar: (value) => `*${value}* `,
159
+ strikethrough: (value) => `~~${value}~~ `,
160
+ blockquote: (value) => `\n> ${value}`,
161
+ newline: () => '\n',
162
+ link: (value) => `[🔗${value.text}](${value.url}) `
163
+ };
157
164
  const createMarkdownText = (data) => {
158
165
  const content = data
159
166
  .map(mdItem => {
160
- if (mdItem.type === 'MD.title') {
161
- // \n
162
- return `# ${mdItem.value}\n`;
163
- }
164
- else if (mdItem.type === 'MD.subtitle') {
165
- // \n
166
- return `## ${mdItem.value}\n`;
167
- }
168
- else if (mdItem.type === 'MD.text') {
169
- // 正文
170
- return `${mdItem.value} `;
171
- }
172
- else if (mdItem.type === 'MD.bold') {
173
- // 加粗
174
- return `**${mdItem.value}** `;
175
- }
176
- else if (mdItem.type === 'MD.divider') {
177
- // 分割线
178
- return '\n————————\n';
179
- }
180
- else if (mdItem.type === 'MD.italic') {
181
- // 斜体
182
- return `_${mdItem.value}_ `;
183
- }
184
- else if (mdItem.type === 'MD.italicStar') {
185
- // 星号斜体
186
- return `*${mdItem.value}* `;
187
- }
188
- else if (mdItem.type === 'MD.strikethrough') {
189
- // 删除线
190
- return `~~${mdItem.value}~~ `;
191
- }
192
- else if (mdItem.type === 'MD.blockquote') {
193
- // \n
194
- return `> ${mdItem.value}\n`;
195
- }
196
- else if (mdItem.type === 'MD.newline') {
197
- // 换行
198
- return '\n';
199
- }
200
- else if (mdItem.type === 'MD.link') {
201
- //
202
- return `[🔗${mdItem.value.text}](${mdItem.value.url}) `;
167
+ if (map[mdItem.type]) {
168
+ const value = mdItem?.value;
169
+ return map[mdItem.type](value);
203
170
  }
204
- else if (mdItem.type === 'MD.image') {
205
- //
206
- return `![text #${mdItem.options?.width || 208}px #${mdItem.options?.height || 320}px](${mdItem.value}) `;
171
+ if (mdItem.type === 'MD.image') {
172
+ return `\n![text #${mdItem.options?.width || 208}px #${mdItem.options?.height || 320}px](${mdItem.value})\n`;
207
173
  }
208
174
  else if (mdItem.type === 'MD.list') {
209
175
  const listStr = mdItem.value.map(listItem => {
210
- // 有序
211
176
  if (typeof listItem.value === 'object') {
212
177
  return `\n${listItem.value.index}. ${listItem.value.text}`;
213
178
  }
214
- // 无序
215
179
  return `\n- ${listItem.value}`;
216
180
  });
217
181
  return `${listStr}\n`;
218
182
  }
219
183
  else if (mdItem.type === 'MD.code') {
220
184
  const language = mdItem?.options?.language || '';
221
- return `\`\`\`${language}\n${mdItem.value}\n\`\`\`\n`;
185
+ return `\n\`\`\`${language}\n${mdItem.value}\n\`\`\`\n`;
222
186
  }
223
187
  else {
224
188
  const value = mdItem['value'] || '';
@@ -228,13 +192,6 @@ const createMarkdownText = (data) => {
228
192
  .join('');
229
193
  return content;
230
194
  };
231
- /**
232
- * 群组消息
233
- * @param client
234
- * @param event
235
- * @param val
236
- * @returns
237
- */
238
195
  const GROUP_AT_MESSAGE_CREATE = async (client, event, val) => {
239
196
  const baseParams = {};
240
197
  if (event.tag === 'INTERACTION_CREATE_GROUP') {
@@ -268,7 +225,6 @@ const GROUP_AT_MESSAGE_CREATE = async (client, event, val) => {
268
225
  if (images && images.length > 0) {
269
226
  let url = '';
270
227
  for (let i = 0; i < images.length; i++) {
271
- // 已经处理。
272
228
  if (url) {
273
229
  break;
274
230
  }
@@ -318,14 +274,12 @@ const GROUP_AT_MESSAGE_CREATE = async (client, event, val) => {
318
274
  }
319
275
  else if (item.type === 'BT.group') {
320
276
  const rows = item.value;
321
- // 构造按钮
322
277
  const content = createButtonsData(rows);
323
278
  params['keyboard'] = {
324
279
  content: content
325
280
  };
326
281
  }
327
282
  else if (item.type === 'Markdown') {
328
- // 如果是markdown,获取内容
329
283
  const content = createMarkdownText(item.value);
330
284
  if (content) {
331
285
  params['markdown'] = {
@@ -342,7 +296,6 @@ const GROUP_AT_MESSAGE_CREATE = async (client, event, val) => {
342
296
  });
343
297
  return [createResult(ResultCode.Ok, 'client.groupOpenMessages', { id: res.id })];
344
298
  }
345
- // ark
346
299
  const ark = val.filter(item => item.type === 'Ark.BigCard' || item.type === 'Ark.Card' || item.type === 'Ark.list');
347
300
  if (ark && ark.length > 0) {
348
301
  const params = {};
@@ -386,13 +339,6 @@ const GROUP_AT_MESSAGE_CREATE = async (client, event, val) => {
386
339
  }
387
340
  return [];
388
341
  };
389
- /**
390
- * 私聊消息
391
- * @param client
392
- * @param event
393
- * @param val
394
- * @returns
395
- */
396
342
  const C2C_MESSAGE_CREATE = async (client, event, val) => {
397
343
  const baseParams = {};
398
344
  if (event.tag === 'INTERACTION_CREATE_C2C') {
@@ -426,7 +372,6 @@ const C2C_MESSAGE_CREATE = async (client, event, val) => {
426
372
  if (images && images.length > 0) {
427
373
  let url = '';
428
374
  for (let i = 0; i < images.length; i++) {
429
- // 已经处理。
430
375
  if (url) {
431
376
  break;
432
377
  }
@@ -476,14 +421,12 @@ const C2C_MESSAGE_CREATE = async (client, event, val) => {
476
421
  }
477
422
  else if (item.type === 'BT.group') {
478
423
  const rows = item.value;
479
- // 构造成按钮
480
424
  const content = createButtonsData(rows);
481
425
  params['keyboard'] = {
482
426
  content: content
483
427
  };
484
428
  }
485
429
  else if (item.type === 'Markdown') {
486
- // 如果是markdown,获取内容
487
430
  const content = createMarkdownText(item.value);
488
431
  if (content) {
489
432
  params['markdown'] = {
@@ -500,7 +443,6 @@ const C2C_MESSAGE_CREATE = async (client, event, val) => {
500
443
  });
501
444
  return [createResult(ResultCode.Ok, 'client.usersOpenMessages', { id: res.id })];
502
445
  }
503
- // ark
504
446
  const ark = val.filter(item => item.type === 'Ark.BigCard' || item.type === 'Ark.Card' || item.type === 'Ark.list');
505
447
  if (ark && ark.length > 0) {
506
448
  const params = {};
@@ -544,13 +486,6 @@ const C2C_MESSAGE_CREATE = async (client, event, val) => {
544
486
  }
545
487
  return [];
546
488
  };
547
- /**
548
- * 频道私聊
549
- * @param client
550
- * @param event
551
- * @param val
552
- * @returns
553
- */
554
489
  const DIRECT_MESSAGE_CREATE = async (client, event, val) => {
555
490
  const baseParams = {};
556
491
  if (event.tag === 'INTERACTION_CREATE_GUILD') {
@@ -576,13 +511,11 @@ const DIRECT_MESSAGE_CREATE = async (client, event, val) => {
576
511
  if (images && images.length > 0) {
577
512
  let imageBuffer = null;
578
513
  for (let i = 0; i < images.length; i++) {
579
- // 已经处理。
580
514
  if (imageBuffer) {
581
515
  break;
582
516
  }
583
517
  const item = images[i];
584
518
  if (item.value === 'ImageURL') {
585
- // 请求得到buffer
586
519
  const data = await axios
587
520
  .get(item.value, {
588
521
  responseType: 'arraybuffer'
@@ -615,14 +548,12 @@ const DIRECT_MESSAGE_CREATE = async (client, event, val) => {
615
548
  }
616
549
  else if (item.type === 'BT.group') {
617
550
  const rows = item.value;
618
- // 构造成按钮
619
551
  const content = createButtonsData(rows);
620
552
  params['keyboard'] = {
621
553
  content: content
622
554
  };
623
555
  }
624
556
  else if (item.type === 'Markdown') {
625
- // 如果是markdown,获取内容
626
557
  const content = createMarkdownText(item.value);
627
558
  if (content) {
628
559
  params['markdown'] = {
@@ -638,7 +569,6 @@ const DIRECT_MESSAGE_CREATE = async (client, event, val) => {
638
569
  });
639
570
  return [createResult(ResultCode.Ok, 'client.dmsMessage', { id: res.id })];
640
571
  }
641
- // ark
642
572
  const ark = val.filter(item => item.type === 'Ark.BigCard' || item.type === 'Ark.Card' || item.type === 'Ark.list');
643
573
  if (ark && ark.length > 0) {
644
574
  const params = {};
@@ -676,12 +606,6 @@ const DIRECT_MESSAGE_CREATE = async (client, event, val) => {
676
606
  return [createResult(ResultCode.Fail, err?.response?.data ?? err?.message ?? err, null)];
677
607
  }
678
608
  };
679
- /**
680
- * 频道公聊
681
- * @param event
682
- * @param val
683
- * @returns
684
- */
685
609
  const MESSAGE_CREATE = async (client, event, val) => {
686
610
  const baseParams = {};
687
611
  if (event.tag === 'INTERACTION_CREATE_GUILD') {
@@ -718,13 +642,11 @@ const MESSAGE_CREATE = async (client, event, val) => {
718
642
  if (images && images.length > 0) {
719
643
  let imageBuffer = null;
720
644
  for (let i = 0; i < images.length; i++) {
721
- // 已经处理。
722
645
  if (imageBuffer) {
723
646
  break;
724
647
  }
725
648
  const item = images[i];
726
649
  if (item.value === 'ImageURL') {
727
- // 请求得到buffer
728
650
  const data = await axios
729
651
  .get(item.value, {
730
652
  responseType: 'arraybuffer'
@@ -757,14 +679,12 @@ const MESSAGE_CREATE = async (client, event, val) => {
757
679
  }
758
680
  else if (item.type === 'BT.group') {
759
681
  const rows = item.value;
760
- // 构造成按钮
761
682
  const content = createButtonsData(rows);
762
683
  params['keyboard'] = {
763
684
  content: content
764
685
  };
765
686
  }
766
687
  else if (item.type === 'Markdown') {
767
- // 如果是markdown,获取内容
768
688
  const content = createMarkdownText(item.value);
769
689
  if (content) {
770
690
  params['markdown'] = {
@@ -780,7 +700,6 @@ const MESSAGE_CREATE = async (client, event, val) => {
780
700
  });
781
701
  return [createResult(ResultCode.Ok, 'client.channelsMessagesPost', { id: res.id })];
782
702
  }
783
- // ark
784
703
  const ark = val.filter(item => item.type === 'Ark.BigCard' || item.type === 'Ark.Card' || item.type === 'Ark.list');
785
704
  if (ark && ark.length > 0) {
786
705
  const params = {};
@@ -818,13 +737,6 @@ const MESSAGE_CREATE = async (client, event, val) => {
818
737
  return [createResult(ResultCode.Fail, err?.response?.data ?? err?.message ?? err, null)];
819
738
  }
820
739
  };
821
- /**
822
- * 频道公聊 @
823
- * @param client
824
- * @param event
825
- * @param val
826
- * @returns
827
- */
828
740
  const AT_MESSAGE_CREATE = (client, event, val) => {
829
741
  return MESSAGE_CREATE(client, event, val);
830
742
  };
package/lib/utils.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const isGuild: (str: string) => boolean;
package/lib/utils.js ADDED
@@ -0,0 +1,8 @@
1
+ const isGuild = (str) => {
2
+ if (isNaN(Number(str.substring(0, 6)))) {
3
+ return false;
4
+ }
5
+ return true;
6
+ };
7
+
8
+ export { isGuild };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.0-alpha.19",
4
- "description": "阿柠檬qqbot平台连接",
3
+ "version": "2.1.0-alpha.20",
4
+ "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "lib/index.js",
9
9
  "scripts": {
10
- "build": "node bundle.js"
10
+ "build": "lvy build"
11
11
  },
12
12
  "dependencies": {
13
13
  "axios": "^1.4.0",
@@ -74,4 +74,4 @@
74
74
  "type": "git",
75
75
  "url": "https://github.com/lemonade-lab/alemonjs.git"
76
76
  }
77
- }
77
+ }