@alemonjs/qq-bot 2.1.0-alpha.2 → 2.1.0-alpha.21

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 (109) hide show
  1. package/README.md +7 -30
  2. package/lib/config.d.ts +8 -0
  3. package/lib/config.js +20 -0
  4. package/lib/desktop.d.ts +1 -3
  5. package/lib/desktop.js +3 -12
  6. package/lib/hook.d.ts +30 -9
  7. package/lib/hook.js +19 -17
  8. package/lib/index.d.ts +5 -6
  9. package/lib/index.js +37 -19
  10. package/lib/index.webhook.d.ts +1 -0
  11. package/lib/index.webhook.js +5 -4
  12. package/lib/index.websoket.d.ts +1 -0
  13. package/lib/index.websoket.js +41 -22
  14. package/lib/message/AT_MESSAGE_CREATE.d.ts +35 -0
  15. package/lib/message/AT_MESSAGE_CREATE.js +1 -0
  16. package/lib/message/CHANNEL_CREATE.d.ts +15 -0
  17. package/lib/message/CHANNEL_CREATE.js +1 -0
  18. package/lib/message/CHANNEL_DELETE.d.ts +15 -0
  19. package/lib/message/CHANNEL_DELETE.js +1 -0
  20. package/lib/message/CHANNEL_UPDATE.d.ts +15 -0
  21. package/lib/message/CHANNEL_UPDATE.js +1 -0
  22. package/lib/message/DIRECT_MESSAGE_CREATE.d.ts +29 -0
  23. package/lib/message/DIRECT_MESSAGE_CREATE.js +1 -0
  24. package/lib/message/DIRECT_MESSAGE_DELETE.d.ts +17 -0
  25. package/lib/message/DIRECT_MESSAGE_DELETE.js +1 -0
  26. package/lib/message/ERROR.d.ts +1 -0
  27. package/lib/message/ERROR.js +1 -0
  28. package/lib/message/GUILD_CREATE.d.ts +15 -0
  29. package/lib/message/GUILD_CREATE.js +1 -0
  30. package/lib/message/GUILD_DELETE.d.ts +15 -0
  31. package/lib/message/GUILD_DELETE.js +1 -0
  32. package/lib/message/GUILD_MEMBER_ADD.d.ts +14 -0
  33. package/lib/message/GUILD_MEMBER_ADD.js +1 -0
  34. package/lib/message/GUILD_MEMBER_REMOVE.d.ts +14 -0
  35. package/lib/message/GUILD_MEMBER_REMOVE.js +1 -0
  36. package/lib/message/GUILD_MEMBER_UPDATE.d.ts +14 -0
  37. package/lib/message/GUILD_MEMBER_UPDATE.js +1 -0
  38. package/lib/message/GUILD_UPDATE.d.ts +15 -0
  39. package/lib/message/GUILD_UPDATE.js +1 -0
  40. package/lib/message/INTERACTION_CREATE.d.ts +53 -0
  41. package/lib/message/INTERACTION_CREATE.js +1 -0
  42. package/lib/message/MESSAGE_CREATE.d.ts +1 -0
  43. package/lib/message/MESSAGE_CREATE.js +1 -0
  44. package/lib/message/MESSAGE_DELETE.d.ts +1 -0
  45. package/lib/message/MESSAGE_DELETE.js +1 -0
  46. package/lib/message/MESSAGE_REACTION_ADD.d.ts +13 -0
  47. package/lib/message/MESSAGE_REACTION_ADD.js +1 -0
  48. package/lib/message/MESSAGE_REACTION_REMOVE.d.ts +13 -0
  49. package/lib/message/MESSAGE_REACTION_REMOVE.js +1 -0
  50. package/lib/message/PUBLIC_MESSAGE_DELETE.d.ts +15 -0
  51. package/lib/message/PUBLIC_MESSAGE_DELETE.js +1 -0
  52. package/lib/message/READY.d.ts +6 -0
  53. package/lib/message/READY.js +1 -0
  54. package/lib/message/group/C2C_MESSAGE_CREATE.d.ts +9 -0
  55. package/lib/message/group/C2C_MESSAGE_CREATE.js +1 -0
  56. package/lib/message/group/C2C_MSG_RECEIVE.d.ts +4 -0
  57. package/lib/message/group/C2C_MSG_RECEIVE.js +1 -0
  58. package/lib/message/group/C2C_MSG_REJECT.d.ts +4 -0
  59. package/lib/message/group/C2C_MSG_REJECT.js +1 -0
  60. package/lib/message/group/FRIEND_ADD.d.ts +4 -0
  61. package/lib/message/group/FRIEND_ADD.js +1 -0
  62. package/lib/message/group/FRIEND_DEL.d.ts +4 -0
  63. package/lib/message/group/FRIEND_DEL.js +1 -0
  64. package/lib/message/group/GROUP_ADD_ROBOT.d.ts +5 -0
  65. package/lib/message/group/GROUP_ADD_ROBOT.js +1 -0
  66. package/lib/message/group/GROUP_AT_MESSAGE_CREATE.d.ts +11 -0
  67. package/lib/message/group/GROUP_AT_MESSAGE_CREATE.js +1 -0
  68. package/lib/message/group/GROUP_DEL_ROBOT.d.ts +5 -0
  69. package/lib/message/group/GROUP_DEL_ROBOT.js +1 -0
  70. package/lib/message/group/GROUP_MSG_RECEIVE.d.ts +5 -0
  71. package/lib/message/group/GROUP_MSG_RECEIVE.js +1 -0
  72. package/lib/message/group/GROUP_MSG_REJECT.d.ts +5 -0
  73. package/lib/message/group/GROUP_MSG_REJECT.js +1 -0
  74. package/lib/register.d.ts +2 -3
  75. package/lib/register.js +270 -176
  76. package/lib/sdk/api.d.ts +196 -969
  77. package/lib/sdk/api.js +267 -916
  78. package/lib/sdk/client.webhook.d.ts +9 -0
  79. package/lib/sdk/{client.js → client.webhook.js} +19 -53
  80. package/lib/sdk/client.websoket.d.ts +9 -0
  81. package/lib/sdk/client.websoket.js +43 -96
  82. package/lib/sdk/config.d.ts +1 -0
  83. package/lib/sdk/instance.d.ts +3 -0
  84. package/lib/sdk/instance.js +93 -0
  85. package/lib/sdk/intents.d.ts +3 -0
  86. package/lib/sdk/intents.js +25 -90
  87. package/lib/sdk/message.d.ts +4 -0
  88. package/lib/sdk/message.group.d.ts +24 -0
  89. package/lib/sdk/message.group.js +1 -0
  90. package/lib/sdk/message.guild.d.ts +38 -0
  91. package/lib/sdk/message.guild.js +1 -0
  92. package/lib/sdk/message.js +1 -0
  93. package/lib/sdk/message.public.d.ts +6 -0
  94. package/lib/sdk/message.public.js +1 -0
  95. package/lib/sdk/typing.d.ts +67 -59
  96. package/lib/sdk/typing.js +1 -0
  97. package/lib/sdk/webhook.secret.d.ts +14 -0
  98. package/lib/sdk/webhook.secret.js +6 -21
  99. package/lib/sends.d.ts +29 -0
  100. package/lib/sends.js +546 -477
  101. package/lib/utils.d.ts +1 -0
  102. package/lib/utils.js +7 -12
  103. package/package.json +9 -5
  104. package/lib/index.group.js +0 -19
  105. package/lib/index.guild.js +0 -36
  106. package/lib/sdk/client.websoket.group.js +0 -221
  107. package/lib/sdk/client.websoket.guild.js +0 -205
  108. package/lib/sdk/counter.js +0 -19
  109. package/lib/sdk/from.js +0 -44
package/lib/sdk/api.d.ts CHANGED
@@ -1,970 +1,197 @@
1
- import * as axios from 'axios'
2
- import { AxiosRequestConfig } from 'axios'
3
- import { ApiRequestData, FileType } from './typing.js'
4
- import FormData from 'form-data'
5
-
6
- declare class QQBotAPI {
7
- #private
8
- /**
9
- * qq机器人
10
- */
11
- BOTS_API_RUL: string
12
- /**
13
- * qq群 沙河接口
14
- */
15
- API_URL_SANDBOX: string
16
- /**
17
- * qq群
18
- */
19
- API_URL: string
20
- /**
21
- * 得到鉴权
22
- * @param app_id
23
- * @param clientSecret
24
- * @returns
25
- */
26
- getAuthentication(app_id: string, clientSecret: string): Promise<axios.AxiosResponse<any, any>>
27
- /**
28
- * group
29
- * @param config
30
- * @returns
31
- */
32
- groupService(options: AxiosRequestConfig): Promise<axios.AxiosResponse<any, any>>
33
- /**
34
- * guild
35
- * @param opstion
36
- * @returns
37
- */
38
- guildServer(opstion: AxiosRequestConfig): Promise<axios.AxiosResponse<any, any>>
39
- /**
40
- * 得到鉴权
41
- * @returns
42
- */
43
- gateway(): Promise<any>
44
- /**
45
- * 发送私聊消息
46
- * @param openid
47
- * @param content
48
- * @param msg_id
49
- * @returns
50
- * 0 文本 1 图文 2 md 3 ark 4 embed
51
- */
52
- usersOpenMessages(
53
- openid: string,
54
- data: ApiRequestData,
55
- _msg_id?: string
56
- ): Promise<{
57
- id: string
58
- timestamp: number
59
- }>
60
- /**
61
- * 得到消息序列
62
- * @param MessageId
63
- * @returns
64
- */
65
- getMessageSeq(MessageId: string): number
66
- /**
67
- * 发送群聊消息
68
- * @param group_openid
69
- * @param data
70
- * @returns
71
- */
72
- groupOpenMessages(
73
- group_openid: string,
74
- data: ApiRequestData
75
- ): Promise<{
76
- id: string
77
- timestamp: number
78
- }>
79
- /**
80
- * 发送私聊富媒体文件
81
- * @param openid
82
- * @param data
83
- * @returns
84
- * 1 图文 2 视频 3 语言 4 文件
85
- * 图片:png/jpg,视频:mp4,语音:silk
86
- */
87
- postRichMediaByUsers(
88
- openid: string,
89
- data: {
90
- srv_send_msg?: boolean
91
- file_type: FileType
92
- url?: string
93
- file_data?: any
94
- }
95
- ): Promise<{
96
- file_uuid: string
97
- file_info: string
98
- ttl: number
99
- }>
100
- /**
101
- * 发送私聊富媒体文件
102
- * @param openid
103
- * @param data
104
- * @returns
105
- * 1 图文 2 视频 3 语言 4 文件
106
- * 图片:png/jpg,视频:mp4,语音:silk
107
- */
108
- userFiles(
109
- openid: string,
110
- data: {
111
- srv_send_msg: boolean
112
- file_type: FileType
113
- url: string
114
- file_data?: any
115
- }
116
- ): Promise<{
117
- file_uuid: string
118
- file_info: string
119
- ttl: number
120
- }>
121
- /**
122
- * 发送群里文件
123
- * @param openid
124
- * @param data
125
- * @returns
126
- * 1 图文 2 视频 3 语言 4 文件
127
- * 图片:png/jpg,视频:mp4,语音:silk
128
- */
129
- postRichMediaByGroup(
130
- openid: string,
131
- data: {
132
- srv_send_msg?: boolean
133
- file_type: FileType
134
- url?: string
135
- file_data?: any
136
- }
137
- ): Promise<{
138
- file_uuid: string
139
- file_info: string
140
- ttl: number
141
- }>
142
- /**
143
- *
144
- * @param openid
145
- * @param data
146
- * @returns
147
- */
148
- groupsFiles(
149
- openid: string,
150
- data: {
151
- srv_send_msg?: boolean
152
- file_type: FileType
153
- url?: string
154
- file_data?: any
155
- }
156
- ): Promise<{
157
- file_uuid: string
158
- file_info: string
159
- ttl: number
160
- }>
161
- /**
162
- * 创建模板
163
- * *********
164
- * 使用该方法,你需要申请模板Id
165
- * 并设置markdown源码为{{.text_0}}{{.text_1}}
166
- * {{.text_2}}{{.text_3}}{{.text_4}}{{.text_5}}
167
- * {{.text_6}}{{.text_7}}{{.text_8}}{{.text_9}}
168
- * 当前,你也可以传递回调对key和values进行休整
169
- * @param custom_template_id
170
- * @param mac 默认 9
171
- * @param callBack 默认 (key,values)=>({key,values})
172
- * @returns
173
- */
174
- createTemplate(
175
- custom_template_id: string,
176
- mac?: number,
177
- callBack?: (
178
- key: string,
179
- values: string[]
180
- ) => {
181
- key: string
182
- values: string[]
183
- }
184
- ): {
185
- size: number
186
- text: (value: string, change?: boolean) => void
187
- prefix: (start: string, label: string) => void
188
- suffix: ({
189
- value,
190
- enter,
191
- reply,
192
- change,
193
- end
194
- }: {
195
- value: any
196
- enter?: boolean
197
- reply?: boolean
198
- change?: boolean
199
- end?: string
200
- }) => void
201
- button: ({
202
- label,
203
- value,
204
- start,
205
- end,
206
- enter,
207
- reply,
208
- change
209
- }: {
210
- label: any
211
- value: any
212
- start?: string
213
- end?: string
214
- enter?: boolean
215
- reply?: boolean
216
- change?: boolean
217
- }) => void
218
- code: (val: string) => void
219
- getParam: () => {
220
- msg_type: number
221
- markdown: {
222
- custom_template_id: string
223
- params: {
224
- key: string
225
- values: string[]
226
- }[]
227
- }
228
- }
229
- }
230
- /**
231
- *
232
- * @param openid
233
- * @param message_id
234
- * @returns
235
- */
236
- userMessageDelete(openid: string, message_id: string): Promise<any>
237
- /**
238
- *
239
- * @param group_openid
240
- * @param message_id
241
- * @returns
242
- */
243
- grouMessageDelte(group_openid: string, message_id: string): Promise<any>
244
- /**
245
- * 创建form
246
- * @param image
247
- * @param msg_id
248
- * @param content
249
- * @param name
250
- * @returns
251
- */
252
- createFrom(image: Buffer, msg_id: string, content: any, Name?: string): Promise<false | FormData>
253
- /**
254
- * ************
255
- * 消息-图片接口
256
- * ***********
257
- */
258
- /**
259
- * 发送buffer图片
260
- * @param id 私信传频道id,公信传子频道id
261
- * @param message {消息编号,图片,内容}
262
- * @param isGroup 是否是群聊
263
- * @returns
264
- */
265
- postImage(
266
- channel_id: string,
267
- message: {
268
- msg_id: string
269
- image: Buffer
270
- content?: string
271
- name?: string
272
- }
273
- ): Promise<any>
274
- /**
275
- * 私聊发送buffer图片
276
- * @param id 私信传频道id,公信传子频道id
277
- * @param message {消息编号,图片,内容}
278
- * @returns
279
- */
280
- postDirectImage(
281
- guild_id: string,
282
- message: {
283
- msg_id: string
284
- image: Buffer
285
- content?: string
286
- name?: string
287
- }
288
- ): Promise<any>
289
- /**
290
- * ********
291
- * 用户api
292
- * *******
293
- */
294
- /**
295
- * 获取用户详情
296
- * @param message
297
- * @returns
298
- */
299
- usersMe(): Promise<any>
300
- /**
301
- * 获取用户频道列表
302
- * @param message
303
- * @returns
304
- */
305
- usersMeGuilds(params: { before: string; after: string; limit: number }): Promise<any>
306
- /**
307
- * **********
308
- * 频道api
309
- * **********
310
- */
311
- /**
312
- * 获取频道详细
313
- * @param guild_id
314
- * @returns
315
- */
316
- guilds(guild_id: string): Promise<any>
317
- /**
318
- * ************
319
- * 子频道api
320
- * ***********
321
- */
322
- /**
323
- * 获取子频道列表
324
- * @param guild_id
325
- * @returns
326
- */
327
- guildsChannels(guild_id: string): Promise<any>
328
- /**
329
- * 获取子频道详情
330
- * @param channel_id
331
- * @returns
332
- */
333
- channels(channel_id: string): Promise<any>
334
- /**
335
- * 创建子频道
336
- * @param guild_id
337
- * @returns
338
- */
339
- guildsChannelsCreate(
340
- guild_id: string,
341
- data: {
342
- name: string
343
- type: number
344
- sub_type: number
345
- position: number
346
- parent_id: string
347
- private_type: number
348
- private_user_ids: string[]
349
- speak_permission: number
350
- application_id: string
351
- }
352
- ): Promise<any>
353
- /**
354
- * 创建子频道
355
- * @param channel_id
356
- * @returns
357
- */
358
- guildsChannelsUpdate(
359
- channel_id: string,
360
- data: {
361
- name: string
362
- position: number
363
- parent_id: string
364
- private_type: number
365
- speak_permission: number
366
- }
367
- ): Promise<any>
368
- /**
369
- * 删除子频道
370
- * @param channel_id
371
- * @param data
372
- * @returns
373
- */
374
- guildsChannelsdelete(
375
- channel_id: string,
376
- data: {
377
- name: string
378
- position: number
379
- parent_id: string
380
- private_type: number
381
- speak_permission: number
382
- }
383
- ): Promise<any>
384
- /**
385
- * 获取在线成员数
386
- * @param channel_id
387
- * @returns
388
- */
389
- channelsChannelOnlineNums(channel_id: string): Promise<any>
390
- /**
391
- * *********
392
- * 成员api
393
- * *********
394
- */
395
- /**
396
- * 获取频道成员列表
397
- * @param guild_id
398
- * @returns
399
- */
400
- guildsMembers(
401
- guild_id: string,
402
- params: {
403
- after: string
404
- limit: number
405
- }
406
- ): Promise<any>
407
- /**
408
- * 获取频道身份组成员列表
409
- * @param guild_id
410
- * @param role_id
411
- * @param params
412
- * @returns
413
- */
414
- guildsRolesMembers(
415
- guild_id: string,
416
- role_id: string,
417
- params: {
418
- start_index: string
419
- limit: number
420
- }
421
- ): Promise<any>
422
- /**
423
- * 获取成员详情
424
- * @param guild_id
425
- * @param user_id
426
- * @returns
427
- */
428
- guildsMembersMessage(guild_id: string, user_id: string): Promise<any>
429
- /**
430
- * 删除频道成员
431
- * @param guild_id
432
- * @param user_id
433
- * @returns
434
- */
435
- guildsMembersDelete(guild_id: string, user_id: string): Promise<any>
436
- /**
437
- * 获取指定消息
438
- * @param channel_id
439
- * @param message_id
440
- * @returns
441
- */
442
- channelsMessages(channel_id: string, message_id: string): Promise<any>
443
- /**
444
- * 发送消息
445
- * @param channel_id
446
- * @param message_id
447
- * @param data
448
- * @returns
449
- */
450
- channelsMessagesPost(
451
- channel_id: string,
452
- data: {
453
- content?: string
454
- embed?: any
455
- ark?: any
456
- message_reference?: any
457
- image?: string
458
- msg_id?: string
459
- event_id?: string
460
- markdown?: any
461
- }
462
- ): Promise<any>
463
- /**
464
- * 撤回消息
465
- * @param channel_id
466
- * @param message_id
467
- * @param hidetip
468
- * @returns
469
- */
470
- channelsMessagesDelete(channel_id: string, message_id: string, hidetip?: boolean): Promise<any>
471
- /**
472
- * ***********
473
- * 频道身份api
474
- * ***********
475
- */
476
- /**
477
- * 获取频道身份组列表
478
- * @param guild_id 频道id
479
- * @returns
480
- */
481
- guildsRoles(guild_id: string): Promise<any>
482
- /**
483
- * 创建频道身份组
484
- * @param guild_id 频道id
485
- * @param {object} data 参数
486
- * @param {object?} data.name 身份组名称
487
- * @param {object?} data.color ARGB 的 HEX 十六进制颜色值转换后的十进制数值
488
- * @param {object?} data.hoist 在成员列表中单独展示: 0-否, 1-是
489
- * @returns
490
- */
491
- guildsRolesPost(
492
- guild_id: string,
493
- data: {
494
- name?: string
495
- color?: number
496
- hoist?: 0 | 1
497
- }
498
- ): Promise<any>
499
- /**
500
- * 修改频道身份组
501
- * @param guild_id 频道id
502
- * @param {object} data 参数
503
- * @param {object?} data.name 身份组名称
504
- * @param {object?} data.color ARGB 的 HEX 十六进制颜色值转换后的十进制数值
505
- * @param {object?} data.hoist 在成员列表中单独展示: 0-否, 1-是
506
- * @returns
507
- */
508
- guildsRolesPatch(
509
- guild_id: string,
510
- role_id: string,
511
- data: {
512
- name?: string
513
- color?: number
514
- hoist?: 0 | 1
515
- }
516
- ): Promise<any>
517
- /**
518
- * 删除频道身份组
519
- * @param guild_id 频道id
520
- * @param role_id 身份组id
521
- */
522
- guildsRolesDelete(guild_id: string, role_id: string): Promise<any>
523
- /**
524
- * 将成员添加到频道身份组
525
- * @param guild_id 频道id
526
- * @param channel_id 子频道id
527
- * @param user_id 用户id
528
- * @param role_id 身份组id
529
- * @returns
530
- */
531
- guildsRolesMembersPut(
532
- guild_id: string,
533
- channel_id: string,
534
- user_id: string,
535
- role_id: string
536
- ): Promise<any>
537
- /**
538
- * 将成员从频道身份组移除
539
- * @param guild_id 频道id
540
- * @param channel_id 子频道id
541
- * @param user_id 用户id
542
- * @param role_id 身份组id
543
- * @returns
544
- */
545
- guildsRolesMembersDelete(
546
- guild_id: string,
547
- channel_id: string,
548
- user_id: string,
549
- role_id: string
550
- ): Promise<any>
551
- /**
552
- * **********
553
- * 子频道权限api
554
- * **********
555
- */
556
- /**
557
- * 获取子频道用户权限
558
- * @param channel_id 子频道id
559
- * @param user_id 用户id
560
- */
561
- channelsPermissions(channel_id: string, user_id: string): Promise<any>
562
- /**
563
- * 修改子频道用户权限
564
- * @param channel_id 子频道id
565
- * @param user_id 用户id
566
- * @param 参数包括add和remove两个字段分别表示授予的权限以及删除的权限。要授予用户权限即把add对应位置 1,删除用户权限即把remove对应位置 1。当两个字段同一位都为 1,表现为删除权限。
567
- */
568
- channelsPermissionsPut(
569
- channel_id: string,
570
- user_id: string,
571
- add: string,
572
- remove: string
573
- ): Promise<any>
574
- /**
575
- * *******
576
- * 消息api
577
- * ********
578
- */
579
- /**
580
- * ************
581
- * 消息频率api
582
- * **********
583
- */
584
- /**
585
- * 查询频道消息频率限制
586
- * @param guild_id 频道id
587
- * @returns
588
- */
589
- guildsMessageSetting(guild_id: string): Promise<any>
590
- /**
591
- * ***********
592
- * 私信api
593
- * **********
594
- */
595
- /**
596
- * 创建私信会话
597
- * @param recipient_id 接收者 id
598
- * @param source_guild_id 源频道 id
599
- * @returns
600
- */
601
- usersMeDms(): Promise<any>
602
- /**
603
- * 发送私信
604
- * @param guild_id
605
- * @returns
606
- */
607
- dmsMessage(
608
- guild_id: string,
609
- data: {
610
- content?: string
611
- embed?: any
612
- ark?: any
613
- message_reference?: any
614
- image?: string
615
- msg_id?: string
616
- event_id?: string
617
- markdown?: any
618
- }
619
- ): Promise<any>
620
- /**
621
- * 撤回私信
622
- * @param guild_id
623
- * @param data
624
- * @returns
625
- */
626
- dmsMessageDelete(guild_id: string, message_id: string, hidetip?: boolean): Promise<any>
627
- /**
628
- * *********
629
- * 禁言api
630
- * *******
631
- */
632
- /**
633
- * 全体禁言(非管理员)
634
- * @param guild_id 频道id
635
- * @param data { mute_end_timestamp:禁言结束时间戳, mute_seconds:禁言时长 } 两个参数必须传一个 优先级 mute_end_timestamp > mute_seconds
636
- * 将mute_end_timestamp或mute_seconds传值为字符串'0',则表示解除全体禁言
637
- */
638
- guildsMuteAll(
639
- guild_id: string,
640
- data: {
641
- mute_end_timestamp?: string
642
- mute_seconds?: string
643
- }
644
- ): Promise<any>
645
- /**
646
- * 频道指定成员禁言
647
- * @param guild_id 频道id
648
- * @param user_id 用户id
649
- * @param data { mute_end_timestamp:禁言结束时间戳, mute_seconds:禁言时长 } 两个参数必须传一个 优先级 mute_end_timestamp > mute_seconds
650
- * 将mute_end_timestamp或mute_seconds传值为字符串'0',则表示解除禁言
651
- * @returns
652
- */
653
- guildsMemberMute(
654
- guild_id: string,
655
- user_id: string,
656
- data: {
657
- mute_end_timestamp?: string
658
- mute_seconds?: string
659
- }
660
- ): Promise<any>
661
- /**
662
- * 频道批量禁言
663
- * @param guild_id 频道id
664
- * @param data { mute_end_timestamp:禁言结束时间戳, mute_seconds:禁言时长, user_ids:用户id数组 } 两个参数必须传一个 优先级 mute_end_timestamp > mute_seconds
665
- * 将mute_end_timestamp或mute_seconds传值为字符串'0',则表示解除禁言
666
- */
667
- guildsMute(
668
- guild_id: string,
669
- data: {
670
- mute_end_timestamp?: string
671
- mute_seconds?: string
672
- user_ids: string[]
673
- }
674
- ): Promise<any>
675
- /**
676
- * *******
677
- * 公告api
678
- * *******
679
- */
680
- /**
681
- * 创建频道公告
682
- * 公告类型分为 消息类型的频道公告 和 推荐子频道类型的频道公告
683
- * 详见 https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/announces/post_guild_announces.html#%E5%8A%9F%E8%83%BD%E6%8F%8F%E8%BF%B0
684
- * @param guild_id 频道id
685
- * @param data { message_id:消息id, channel_id:频道id, announces_type:公告类型, recommend_channels:推荐频道id数组 }
686
- * @param channel_id 子频道id 消息id存在时必须传
687
- * @param announces_type 0:成员公告 1:欢迎公告 默认为 0
688
- * @param recommend_channels 推荐频道id数组 "recommend_channels": [{ "channel_id": "xxxx","introduce": "推荐语" }]
689
- * @returns 返回Announces 对象 (https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/announces/model.html#Announces)
690
- */
691
- guildsAnnounces(
692
- guild_id: string,
693
- data: {
694
- message_id?: string
695
- channel_id?: string
696
- announces_type?: 0 | 1
697
- recommend_channels?: string[]
698
- }
699
- ): Promise<any>
700
- /**
701
- * 删除频道公告
702
- * @param guild_id 频道id
703
- * @param message_id 消息id message_id 有值时,会校验 message_id 合法性,若不校验校验 message_id,请将 message_id 设置为 all
704
- * @returns
705
- */
706
- guildsAnnouncesDelete(guild_id: string, message_id: string): Promise<any>
707
- /**
708
- * **********
709
- * 精华消息api
710
- * **********
711
- */
712
- /**
713
- * 添加精华消息
714
- * @param channel_id 频道id
715
- * @param message_id 消息id
716
- * @returns 返回 PinsMessage对象 { "guild_id": "xxxxxx", "channel_id": "xxxxxx", "message_ids": ["xxxxx"]}
717
- * @returns message_ids 为当前请求后子频道内所有精华消息 message_id 数组
718
- */
719
- channelsPinsPut(channel_id: string, message_id: string): Promise<any>
720
- /**
721
- * 删除精华消息
722
- * @param channel_id 子频道id
723
- * @param message_id 消息id
724
- * 删除子频道内全部精华消息,请将 message_id 设置为 all
725
- * @returns
726
- */
727
- channelsPinsDelete(channel_id: string, message_id: string): Promise<any>
728
- /**
729
- * 获取精华消息
730
- * @param channel_id 子频道id
731
- * @returns 返回 PinsMessage对象 { "guild_id": "xxxxxx", "channel_id": "xxxxxx", "message_ids": ["xxxxx"]}
732
- * @returns message_ids 为当前请求后子频道内所有精华消息 message_id 数组
733
- */
734
- channelsPins(channel_id: string): Promise<any>
735
- /**
736
- * ********
737
- * 日程api
738
- * *******
739
- */
740
- /**
741
- * 获取频道日程列表
742
- * @param channel_id 子频道id
743
- * @returns 返回 Schedule 对象数组(详见https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/schedule/model.html#schedule)
744
- */
745
- channelsSchedules(channel_id: string): Promise<any>
746
- /**
747
- * 获取频道日程详情
748
- * @param channel_id 子频道id
749
- * @param schedule_id 日程id
750
- * @returns 返回 Schedule 对象(详见https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/schedule/model.html#schedule)
751
- */
752
- channelsSchedulesSchedule(channel_id: string, schedule_id: string): Promise<any>
753
- /**
754
- * 创建频道日程
755
- * @param channel_id 子频道id
756
- * @param name 日程名称
757
- * @param description 日程描述
758
- * @param start_timestamp 日程开始时间戳
759
- * @param end_timestamp 日程结束时间戳
760
- * @param jump_channel_id 日程开始时跳转的子频道id
761
- * @param remind_type 日程提醒类型
762
- * 0 不提醒
763
- * 1 开始时提醒
764
- * 2 开始前 5 分钟提醒
765
- * 3 开始前 15 分钟提醒
766
- * 4 开始前 30 分钟提醒
767
- * 5 开始前 60 分钟提醒
768
- * @returns 返回 Schedule 对象(详见https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/schedule/model.html#schedule)
769
- */
770
- channelsSchedulesPost(
771
- channel_id: string,
772
- data: {
773
- schedule: {
774
- name: string
775
- description?: string
776
- start_timestamp: string
777
- end_timestamp: string
778
- jump_channel_id: string
779
- remind_type: number
780
- }
781
- }
782
- ): Promise<any>
783
- /**
784
- * 修改频道日程
785
- * @param channel_id 子频道id
786
- * @param schedule_id 日程id
787
- * @param name 日程名称
788
- * @param description 日程描述
789
- * @param start_timestamp 日程开始时间戳
790
- * @param end_timestamp 日程结束时间戳
791
- * @param jump_channel_id 日程开始时跳转的子频道id
792
- * @param remind_type 日程提醒类型
793
- * 0 不提醒
794
- * 1 开始时提醒
795
- * 2 开始前 5 分钟提醒
796
- * 3 开始前 15 分钟提醒
797
- * 4 开始前 30 分钟提醒
798
- * 5 开始前 60 分钟提醒
799
- * @returns 返回 Schedule 对象(详见https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/schedule/model.html#schedule)
800
- */
801
- channelsSchedulesSchedulePatch(
802
- channel_id: string,
803
- schedule_id: string,
804
- data: {
805
- schedule: {
806
- name: string
807
- description?: string
808
- start_timestamp: string
809
- end_timestamp: string
810
- jump_channel_id: string
811
- remind_type: number
812
- }
813
- }
814
- ): Promise<any>
815
- /**
816
- * 删除频道日程
817
- * @param channel_id 子频道id
818
- * @param schedule_id 日程id
819
- * @returns
820
- */
821
- channelsSchedulesScheduleDelete(channel_id: string, schedule_id: string): Promise<any>
822
- /**
823
- * ***********
824
- * 表情表态api
825
- * ***********
826
- */
827
- /**
828
- * 机器人发表表情表态
829
- * @param channel_id 子频道id
830
- * @param message_id 消息id
831
- * @param type 表情类型 1:系统表情 2:emoji表情
832
- * @param id 表情id 参考https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#Emoji%20%E5%88%97%E8%A1%A8
833
- * @returns
834
- */
835
- channelsMessagesReactionsPut(
836
- channel_id: string,
837
- message_id: string,
838
- type: 1 | 2,
839
- id: string
840
- ): Promise<any>
841
- /**
842
- * 删除机器人发表的表情表态
843
- * @param channel_id 子频道id
844
- * @param message_id 消息id
845
- * @param type 表情类型 1:系统表情 2:emoji表情
846
- * @param id 表情id 参考https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#Emoji%20%E5%88%97%E8%A1%A8
847
- * @returns
848
- */
849
- channelsMessagesReactionsDelete(
850
- channel_id: string,
851
- message_id: string,
852
- type: 1 | 2,
853
- id: string
854
- ): Promise<any>
855
- /**
856
- * 获取消息表情表态的用户列表
857
- * @param channel_id 子频道id
858
- * @param message_id 消息id
859
- * @param type 表情类型 1:系统表情 2:emoji表情
860
- * @param id 表情id 参考https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#Emoji%20%E5%88%97%E8%A1%A8
861
- * @param {object} data
862
- * @param {object} data.cookie 返回的cookie 第一次请求不传,后续请求传上次返回的cookie
863
- * @param {object} data.limit 返回的用户数量 默认20 最大50
864
- * @returns data:{ users:User[], cookie:string,is_end:true|false }
865
- */
866
- channelsMessagesReactionsUsers(
867
- channel_id: string,
868
- message_id: string,
869
- type: 1 | 2,
870
- id: string,
871
- data: {
872
- cookie?: string
873
- limit?: number
874
- }
875
- ): Promise<any>
876
- /**
877
- * ***********
878
- * 音频api
879
- * 音频接口:仅限音频类机器人才能使用,后续会根据机器人类型自动开通接口权限,现如需调用,需联系平台申请权限
880
- * **********
881
- */
882
- /**
883
- * 音频控制
884
- * @param channel_id 子频道id
885
- * @param audio_url 音频url status为0时传
886
- * @param status 0:开始 1:暂停 2:继续 3:停止
887
- * @param text 状态文本(比如:简单爱-周杰伦),可选,status为0时传,其他操作不传
888
- * @returns
889
- */
890
- channelsAudioPost(
891
- channel_id: string,
892
- data: {
893
- audio_url?: string
894
- text?: string
895
- status: 0 | 1 | 2 | 3
896
- }
897
- ): Promise<any>
898
- /**
899
- * 机器人上麦
900
- * @param channel_id 语音子频道id
901
- * @returns {}
902
- */
903
- channelsMicPut(channel_id: string): Promise<any>
904
- /**
905
- * 机器人下麦
906
- * @param channel_id 语音子频道id
907
- * @returns {}
908
- */
909
- channelsMicDelete(channel_id: string): Promise<any>
910
- /**
911
- * **********
912
- * 帖子api
913
- * 注意
914
- * 公域机器人暂不支持申请,仅私域机器人可用,选择私域机器人后默认开通。
915
- * 注意: 开通后需要先将机器人从频道移除,然后重新添加,方可生效。
916
- * **********
917
- */
918
- /**
919
- * 获取帖子列表
920
- * @param channel_id 子频道id
921
- * @returns {threads:Thread[],is_finish:0|1}
922
- * @returns 返回 Thread 对象数组(详见https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/forum/model.html#Thread)
923
- * @returns is_finish 为 1 时,表示已拉取完 为 0 时,表示未拉取完
924
- */
925
- channelsThreads(channel_id: string): Promise<any>
926
- /**
927
- * 获取帖子详情
928
- * @param channel_id 子频道id
929
- * @param thread_id 帖子id
930
- * @returns 返回 帖子详情对象(详见https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/forum/model.html#ThreadInfo)
931
- * 其中content字段可参考 https://bot.q.qq.com/wiki/develop/api-v2/server-inter/channel/content/forum/model.html#RichText
932
- */
933
- channelsThreadsThread(channel_id: string, thread_id: string): Promise<any>
934
- /**
935
- * 发表帖子
936
- * @param channel_id 子频道id
937
- * @param title 帖子标题
938
- * @param content 帖子内容
939
- * @param format 帖子内容格式 1:纯文本 2:HTML 3:Markdown 4:JSON
940
- * @returns 返回 {task_id:string,create_time:string} 其中 task_id 为帖子id,create_time 发帖时间戳
941
- */
942
- channelsThreadsPut(
943
- channel_id: string,
944
- data: {
945
- title: string
946
- content: string
947
- format: 1 | 2 | 3 | 4
948
- }
949
- ): Promise<any>
950
- /**
951
- * 删除帖子
952
- * @param channel_id 子频道id
953
- * @param thread_id 帖子id
954
- * @returns
955
- */
956
- channelsThreadsDelete(channel_id: string, thread_id: string): Promise<any>
957
- /**
958
- * ********
959
- * 接口权限api
960
- * **********
961
- */
962
- /**
963
- * 获得频道可用权限列表
964
- * @param guild_id
965
- * @returns
966
- */
967
- guildApiPermission(guild_id: string): Promise<any>
1
+ import { type AxiosRequestConfig } from 'axios';
2
+ import { ApiRequestData, FileType } from './typing.js';
3
+ export declare const BOTS_API_RUL = "https://bots.qq.com";
4
+ export declare const API_URL_SANDBOX = "https://sandbox.api.sgroup.qq.com";
5
+ export declare const API_URL = "https://api.sgroup.qq.com";
6
+ export declare class QQBotAPI {
7
+ getAuthentication(app_id: string, clientSecret: string): Promise<import("axios").AxiosResponse<any, any>>;
8
+ groupService(options: AxiosRequestConfig): Promise<any>;
9
+ guildServer(opstion: AxiosRequestConfig): Promise<any>;
10
+ gateway(): Promise<any>;
11
+ usersOpenMessages(openid: string, data: ApiRequestData): Promise<{
12
+ id: string;
13
+ timestamp: number;
14
+ }>;
15
+ getMessageSeq(MessageId: string): number;
16
+ groupOpenMessages(group_openid: string, data: ApiRequestData): Promise<{
17
+ id: string;
18
+ timestamp: number;
19
+ }>;
20
+ postRichMediaByUser(openid: string, data: {
21
+ srv_send_msg?: boolean;
22
+ file_type: FileType;
23
+ url?: string;
24
+ file_data?: any;
25
+ }): Promise<{
26
+ file_uuid: string;
27
+ file_info: string;
28
+ ttl: number;
29
+ }>;
30
+ postRichMediaByGroup(openid: string, data: {
31
+ srv_send_msg?: boolean;
32
+ file_type: FileType;
33
+ url?: string;
34
+ file_data?: any;
35
+ }): Promise<{
36
+ file_uuid: string;
37
+ file_info: string;
38
+ ttl: number;
39
+ }>;
40
+ userMessageDelete(openid: string, message_id: string): Promise<any>;
41
+ grouMessageDelte(group_openid: string, message_id: string): Promise<any>;
42
+ channelsMessages(channel_id: string, message: {
43
+ content?: string;
44
+ embed?: any;
45
+ ark?: any;
46
+ message_reference?: any;
47
+ image?: string;
48
+ msg_id?: string;
49
+ event_id?: string;
50
+ markdown?: any;
51
+ }, image?: Buffer): Promise<any>;
52
+ dmsMessages(guild_id: string, message: {
53
+ content?: string;
54
+ embed?: any;
55
+ ark?: any;
56
+ message_reference?: any;
57
+ image?: string;
58
+ msg_id?: string;
59
+ event_id?: string;
60
+ markdown?: any;
61
+ }, image?: Buffer): Promise<any>;
62
+ usersMe(): Promise<any>;
63
+ usersMeGuilds(params: {
64
+ before: string;
65
+ after: string;
66
+ limit: number;
67
+ }): Promise<any>;
68
+ guilds(guild_id: string): Promise<any>;
69
+ guildsChannels(guild_id: string): Promise<any>;
70
+ channels(channel_id: string): Promise<any>;
71
+ guildsChannelsCreate(guild_id: string, data: {
72
+ name: string;
73
+ type: number;
74
+ sub_type: number;
75
+ position: number;
76
+ parent_id: string;
77
+ private_type: number;
78
+ private_user_ids: string[];
79
+ speak_permission: number;
80
+ application_id: string;
81
+ }): Promise<any>;
82
+ guildsChannelsUpdate(channel_id: string, data: {
83
+ name: string;
84
+ position: number;
85
+ parent_id: string;
86
+ private_type: number;
87
+ speak_permission: number;
88
+ }): Promise<any>;
89
+ guildsChannelsdelete(channel_id: string, data: {
90
+ name: string;
91
+ position: number;
92
+ parent_id: string;
93
+ private_type: number;
94
+ speak_permission: number;
95
+ }): Promise<any>;
96
+ channelsChannelOnlineNums(channel_id: string): Promise<any>;
97
+ guildsMembers(guild_id: string, params: {
98
+ after: string;
99
+ limit: number;
100
+ }): Promise<any>;
101
+ guildsRolesMembers(guild_id: string, role_id: string, params: {
102
+ start_index: string;
103
+ limit: number;
104
+ }): Promise<any>;
105
+ guildsMembersMessage(guild_id: string, user_id: string): Promise<any>;
106
+ guildsMembersDelete(guild_id: string, user_id: string): Promise<any>;
107
+ channelsMessagesById(channel_id: string, message_id: string): Promise<any>;
108
+ channelsMessagesDelete(channel_id: string, message_id: string, hidetip?: boolean): Promise<any>;
109
+ guildsRoles(guild_id: string): Promise<any>;
110
+ guildsRolesPost(guild_id: string, data: {
111
+ name?: string;
112
+ color?: number;
113
+ hoist?: 0 | 1;
114
+ }): Promise<any>;
115
+ guildsRolesPatch(guild_id: string, role_id: string, data: {
116
+ name?: string;
117
+ color?: number;
118
+ hoist?: 0 | 1;
119
+ }): Promise<any>;
120
+ guildsRolesDelete(guild_id: string, role_id: string): Promise<any>;
121
+ guildsRolesMembersPut(guild_id: string, channel_id: string, user_id: string, role_id: string): Promise<any>;
122
+ guildsRolesMembersDelete(guild_id: string, channel_id: string, user_id: string, role_id: string): Promise<any>;
123
+ channelsPermissions(channel_id: string, user_id: string): Promise<any>;
124
+ channelsPermissionsPut(channel_id: string, user_id: string, add: string, remove: string): Promise<any>;
125
+ guildsMessageSetting(guild_id: string): Promise<any>;
126
+ usersMeDms(): Promise<any>;
127
+ dmsMessageDelete(guild_id: string, message_id: string, hidetip?: boolean): Promise<any>;
128
+ guildsMuteAll(guild_id: string, data: {
129
+ mute_end_timestamp?: string;
130
+ mute_seconds?: string;
131
+ }): Promise<any>;
132
+ guildsMemberMute(guild_id: string, user_id: string, data: {
133
+ mute_end_timestamp?: string;
134
+ mute_seconds?: string;
135
+ }): Promise<any>;
136
+ guildsMute(guild_id: string, data: {
137
+ mute_end_timestamp?: string;
138
+ mute_seconds?: string;
139
+ user_ids: string[];
140
+ }): Promise<any>;
141
+ guildsAnnounces(guild_id: string, data: {
142
+ message_id?: string;
143
+ channel_id?: string;
144
+ announces_type?: 0 | 1;
145
+ recommend_channels?: string[];
146
+ }): Promise<any>;
147
+ guildsAnnouncesDelete(guild_id: string, message_id: string): Promise<any>;
148
+ channelsPinsPut(channel_id: string, message_id: string): Promise<any>;
149
+ channelsPinsDelete(channel_id: string, message_id: string): Promise<any>;
150
+ channelsPins(channel_id: string): Promise<any>;
151
+ channelsSchedules(channel_id: string): Promise<any>;
152
+ channelsSchedulesSchedule(channel_id: string, schedule_id: string): Promise<any>;
153
+ channelsSchedulesPost(channel_id: string, data: {
154
+ schedule: {
155
+ name: string;
156
+ description?: string;
157
+ start_timestamp: string;
158
+ end_timestamp: string;
159
+ jump_channel_id: string;
160
+ remind_type: number;
161
+ };
162
+ }): Promise<any>;
163
+ channelsSchedulesSchedulePatch(channel_id: string, schedule_id: string, data: {
164
+ schedule: {
165
+ name: string;
166
+ description?: string;
167
+ start_timestamp: string;
168
+ end_timestamp: string;
169
+ jump_channel_id: string;
170
+ remind_type: number;
171
+ };
172
+ }): Promise<any>;
173
+ channelsSchedulesScheduleDelete(channel_id: string, schedule_id: string): Promise<any>;
174
+ channelsMessagesReactionsPut(channel_id: string, message_id: string, type: 1 | 2, id: string): Promise<any>;
175
+ channelsMessagesReactionsDelete(channel_id: string, message_id: string, type: 1 | 2, id: string): Promise<any>;
176
+ channelsMessagesReactionsUsers(channel_id: string, message_id: string, type: 1 | 2, id: string, data: {
177
+ cookie?: string;
178
+ limit?: number;
179
+ }): Promise<any>;
180
+ channelsAudioPost(channel_id: string, data: {
181
+ audio_url?: string;
182
+ text?: string;
183
+ status: 0 | 1 | 2 | 3;
184
+ }): Promise<any>;
185
+ channelsMicPut(channel_id: string): Promise<any>;
186
+ channelsMicDelete(channel_id: string): Promise<any>;
187
+ channelsThreads(channel_id: string): Promise<any>;
188
+ channelsThreadsThread(channel_id: string, thread_id: string): Promise<any>;
189
+ channelsThreadsPut(channel_id: string, data: {
190
+ title: string;
191
+ content: string;
192
+ format: 1 | 2 | 3 | 4;
193
+ }): Promise<any>;
194
+ channelsThreadsDelete(channel_id: string, thread_id: string): Promise<any>;
195
+ guildApiPermission(guild_id: string): Promise<any>;
196
+ interactionResponse(mode: 'group' | 'guild', interaction_id: string, code?: number): Promise<any>;
968
197
  }
969
-
970
- export { QQBotAPI }