@im-more/dsh-kook 0.0.0-stage → 0.1.0

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 (76) hide show
  1. package/LICENSE +21 -0
  2. package/cordis.patch.yml +12 -0
  3. package/lib/index.js +2380 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/types/bot.d.ts +53 -0
  6. package/lib/types/bot.d.ts.map +1 -0
  7. package/lib/types/bot.js +138 -0
  8. package/lib/types/bot.js.map +1 -0
  9. package/lib/types/config.d.ts +46 -0
  10. package/lib/types/config.d.ts.map +1 -0
  11. package/lib/types/config.js +52 -0
  12. package/lib/types/config.js.map +1 -0
  13. package/lib/types/decode.d.ts +88 -0
  14. package/lib/types/decode.d.ts.map +1 -0
  15. package/lib/types/decode.js +564 -0
  16. package/lib/types/decode.js.map +1 -0
  17. package/lib/types/errors.d.ts +46 -0
  18. package/lib/types/errors.d.ts.map +1 -0
  19. package/lib/types/errors.js +159 -0
  20. package/lib/types/errors.js.map +1 -0
  21. package/lib/types/identity.d.ts +17 -0
  22. package/lib/types/identity.d.ts.map +1 -0
  23. package/lib/types/identity.js +24 -0
  24. package/lib/types/identity.js.map +1 -0
  25. package/lib/types/index.d.ts +15 -0
  26. package/lib/types/index.d.ts.map +1 -0
  27. package/lib/types/index.js +15 -0
  28. package/lib/types/index.js.map +1 -0
  29. package/lib/types/kmarkdown.d.ts +76 -0
  30. package/lib/types/kmarkdown.d.ts.map +1 -0
  31. package/lib/types/kmarkdown.js +201 -0
  32. package/lib/types/kmarkdown.js.map +1 -0
  33. package/lib/types/modes/kmarkdown.d.ts +17 -0
  34. package/lib/types/modes/kmarkdown.d.ts.map +1 -0
  35. package/lib/types/modes/kmarkdown.js +166 -0
  36. package/lib/types/modes/kmarkdown.js.map +1 -0
  37. package/lib/types/modes/shared.d.ts +192 -0
  38. package/lib/types/modes/shared.d.ts.map +1 -0
  39. package/lib/types/modes/shared.js +371 -0
  40. package/lib/types/modes/shared.js.map +1 -0
  41. package/lib/types/request.d.ts +53 -0
  42. package/lib/types/request.d.ts.map +1 -0
  43. package/lib/types/request.js +147 -0
  44. package/lib/types/request.js.map +1 -0
  45. package/lib/types/send.d.ts +57 -0
  46. package/lib/types/send.d.ts.map +1 -0
  47. package/lib/types/send.js +141 -0
  48. package/lib/types/send.js.map +1 -0
  49. package/lib/types/types.d.ts +807 -0
  50. package/lib/types/types.d.ts.map +1 -0
  51. package/lib/types/types.js +168 -0
  52. package/lib/types/types.js.map +1 -0
  53. package/lib/types/webhook.d.ts +35 -0
  54. package/lib/types/webhook.d.ts.map +1 -0
  55. package/lib/types/webhook.js +132 -0
  56. package/lib/types/webhook.js.map +1 -0
  57. package/lib/types/ws.d.ts +54 -0
  58. package/lib/types/ws.d.ts.map +1 -0
  59. package/lib/types/ws.js +358 -0
  60. package/lib/types/ws.js.map +1 -0
  61. package/package.json +61 -3
  62. package/src/bot.ts +217 -0
  63. package/src/config.ts +84 -0
  64. package/src/decode.ts +660 -0
  65. package/src/errors.ts +188 -0
  66. package/src/identity.ts +32 -0
  67. package/src/index.ts +80 -0
  68. package/src/kmarkdown.ts +246 -0
  69. package/src/modes/kmarkdown.ts +204 -0
  70. package/src/modes/shared.ts +498 -0
  71. package/src/request.ts +196 -0
  72. package/src/send.ts +216 -0
  73. package/src/types.ts +764 -0
  74. package/src/webhook.ts +170 -0
  75. package/src/ws.ts +431 -0
  76. package/README.md +0 -3
package/src/types.ts ADDED
@@ -0,0 +1,764 @@
1
+ /* eslint-disable max-len */
2
+ import type { KookBot } from './bot.ts'
3
+ import { invoke, type KookRequest } from './request.ts'
4
+
5
+ export enum Signal {
6
+ event,
7
+ hello,
8
+ ping,
9
+ pong,
10
+ reconnect,
11
+ resume,
12
+ }
13
+
14
+ export interface Payload {
15
+ s: Signal
16
+ sn?: number
17
+ d: Data
18
+ }
19
+
20
+ export enum Type {
21
+ text = 1,
22
+ image = 2,
23
+ video = 3,
24
+ file = 4,
25
+ unknown = 7,
26
+ audio = 8,
27
+ kmarkdown = 9,
28
+ card = 10,
29
+ system = 255,
30
+ }
31
+
32
+ export interface MessageParams {
33
+ type: Type
34
+ msg_id: string
35
+ chat_code: string
36
+ target_id: string
37
+ content: any
38
+ quote: string
39
+ nonce: string
40
+ }
41
+
42
+ export interface MessageBase {
43
+ type: Type
44
+ content: string
45
+ }
46
+
47
+ export interface Data<E = any> extends MessageBase {
48
+ channel_type: 'GROUP' | 'PERSON' | 'WEBHOOK_CHALLENGE'
49
+ challenge: string
50
+ verify_token: string
51
+ target_id: string
52
+ author_id: string
53
+ msg_id: string
54
+ msg_timestamp: number
55
+ nonce: string
56
+ extra: E
57
+ }
58
+
59
+ type AttachmentType = 'image' | 'video' | 'audio' | 'file'
60
+ type NoticeType =
61
+ | 'user_updated'
62
+ | 'message_btn_click'
63
+ | 'added_reaction' | 'deleted_reaction'
64
+ | 'updated_message' | 'deleted_message'
65
+ | 'pinned_message' | 'unpinned_message'
66
+ | 'joined_guild' | 'exited_guild' | 'updated_guild_member'
67
+ | 'updated_guild' | 'deleted_guild'
68
+ | 'self_joined_guild' | 'self_exited_guild'
69
+ | 'added_role' | 'deleted_role' | 'updated_role'
70
+ | 'added_block_list' | 'deleted_block_list'
71
+ | 'added_emoji' | 'updated_emoji'
72
+ | 'added_channel' | 'updated_channel' | 'deleted_channel'
73
+ | 'updated_private_message' | 'deleted_private_message'
74
+ | 'private_added_reaction' | 'private_deleted_reaction'
75
+ | 'joined_channel' | 'exited_channel'
76
+ | 'guild_member_online' | 'guild_member_offline'
77
+
78
+ export interface MessageMeta {
79
+ mention: string[]
80
+ mention_all: boolean
81
+ mention_roles: string[]
82
+ mention_here: boolean
83
+ attachments: Attachment
84
+ quote: Message
85
+ author: Author
86
+ kmarkdown?: {
87
+ raw_content: string
88
+ mention_part: KmarkdownUserMeta[]
89
+ mention_role_part: KmarkdownRoleMeta[]
90
+ }
91
+ }
92
+
93
+ export interface PrivateChat {
94
+ code: string
95
+ last_read_time: number
96
+ latest_msg_time: number
97
+ unread_count: number
98
+ is_friend: boolean
99
+ is_blocked: boolean
100
+ is_target_blocked: boolean
101
+ target_info: User
102
+ }
103
+
104
+ export interface KmarkdownUserMeta {
105
+ id: string
106
+ username: string
107
+ full_name: string
108
+ avatar: string
109
+ }
110
+
111
+ export interface KmarkdownRoleMeta {
112
+ role_id: number
113
+ name: string
114
+ color: number
115
+ }
116
+
117
+ export interface MessageExtra extends MessageMeta {
118
+ type: Type
119
+ code: string
120
+ guild_id: string
121
+ channel_name: string
122
+ }
123
+
124
+ export interface Message extends MessageBase, MessageMeta {
125
+ id: string
126
+ rong_id?: string
127
+ embeds: any[]
128
+ reactions: any[]
129
+ mention_info: object
130
+ extra: MessageExtra | Notice
131
+ }
132
+
133
+ export interface MessageReturn {
134
+ msg_id: string
135
+ msg_timestamp: number
136
+ nonce: string
137
+ }
138
+
139
+ export interface Card {
140
+ type: 'card'
141
+ theme?: Card.Theme
142
+ size?: Card.Size
143
+ modules: Card.Module[]
144
+ }
145
+
146
+ export namespace Card {
147
+ export const Theme = ['primary', 'secondary', 'warning', 'danger', 'info', 'none', 'success'] as const
148
+ export type Theme = typeof Theme[number]
149
+ export const Size = ['lg', 'sm'] as const
150
+ export type Size = typeof Size[number]
151
+ export type Module = Section | Container | ImageGroup | ActionGroup | Header | Divider | Invite | File | Countdown | Context
152
+
153
+ export interface Text {
154
+ type: 'plain-text' | 'kmarkdown'
155
+ content: string
156
+ emoji?: boolean
157
+ }
158
+
159
+ export interface Paragraph {
160
+ type: 'paragraph'
161
+ cols: number
162
+ fields: Text[]
163
+ }
164
+
165
+ export interface Section {
166
+ type: 'section'
167
+ mode?: 'left' | 'right'
168
+ text: Text | Paragraph
169
+ accessory?: Image | Button
170
+ }
171
+
172
+ export interface Container {
173
+ type: 'container'
174
+ elements: Image[]
175
+ }
176
+
177
+ export interface Image {
178
+ type: 'image'
179
+ size?: 'lg' | 'sm'
180
+ src: string
181
+ alt?: string
182
+ circle?: boolean
183
+ }
184
+
185
+ export interface Button {
186
+ type: 'button'
187
+ theme?: Button.Theme
188
+ value?: string
189
+ text: Text
190
+ click?: string
191
+ }
192
+
193
+ export namespace Button {
194
+ export const Theme = ['primary', 'secondary', 'warning', 'danger', 'info', 'none', 'success'] as const
195
+ export type Theme = typeof Theme[number]
196
+ }
197
+
198
+ export interface ImageGroup {
199
+ type: 'image-group'
200
+ elements: Image[]
201
+ }
202
+
203
+ export interface Header {
204
+ type: 'header'
205
+ text: Text
206
+ }
207
+
208
+ export interface Divider {
209
+ type: 'divider'
210
+ }
211
+
212
+ export interface Invite {
213
+ type: 'invite'
214
+ code: string
215
+ }
216
+
217
+ export interface ActionGroup {
218
+ type: 'action-group'
219
+ elements: Button[]
220
+ }
221
+
222
+ export interface Context {
223
+ type: 'context'
224
+ elements: (Text | Image)[]
225
+ }
226
+
227
+ export interface File {
228
+ type: 'file' | 'audio' | 'video'
229
+ src: string
230
+ title: string
231
+ cover?: string
232
+ }
233
+
234
+ export interface Countdown {
235
+ type: 'countdown'
236
+ endTime: number
237
+ startTime: number
238
+ mode: 'day' | 'hour' | 'second'
239
+ }
240
+ }
241
+
242
+ export interface User {
243
+ id: string
244
+ username: string
245
+ identify_num: string
246
+ avatar: string
247
+ online: boolean
248
+ bot?: boolean
249
+ roles: number[]
250
+ vip_avatar?: string
251
+ is_vip?: boolean
252
+ mobile_verified: boolean
253
+ joined_at?: number
254
+ active_time?: number
255
+ status: UserStatus
256
+ }
257
+
258
+ export enum UserStatus {
259
+ normal = 0,
260
+ normal_1 = 1,
261
+ banned = 10,
262
+ }
263
+
264
+ export interface Self extends User {
265
+ status: UserStatus
266
+ mobile_verified: boolean
267
+ system: boolean
268
+ mobile_prefix: string
269
+ mobile: string
270
+ invited_count: number
271
+ }
272
+
273
+ export interface Author extends User {
274
+ roles: number[]
275
+ nickname?: string
276
+ }
277
+
278
+ export interface Attachment {
279
+ type: AttachmentType
280
+ name: string
281
+ url: string
282
+ file_type: string
283
+ size: number
284
+ duration: number
285
+ width: number
286
+ height: number
287
+ }
288
+
289
+ export interface Notice {
290
+ type: NoticeType
291
+ body: NoticeBody
292
+ }
293
+
294
+ export interface Channel {
295
+ id: string
296
+ name: string
297
+ user_id: string
298
+ user_info?: User
299
+ guild_id: string
300
+ is_category: boolean
301
+ parent_id: string
302
+ topic: string
303
+ type: 0 | 1 | 2
304
+ level: number
305
+ slow_mode?: 0 | 5000 | 10000 | 15000 | 30000 | 60000 | 120000 | 300000 | 600000 | 900000 | 1800000 | 3600000 | 7200000 | 21600000
306
+ has_password?: boolean
307
+ limit_amount: number
308
+ permission_overwrites?: Overwrite[]
309
+ permission_users?: any[]
310
+ permission_sync?: 0 | 1
311
+ voice_quality?: '1' | '2' | '3'
312
+ server_url?: string
313
+ children?: string[]
314
+ }
315
+
316
+ export interface NoticeBody extends Channel, MessageMeta, GuildRole {
317
+ value: string
318
+ msg_id: string
319
+ channel_type: 'GROUP' | 'PERSON'
320
+ author_id: string
321
+ target_id: string
322
+ channel_id: string
323
+ operator_id: string
324
+ emoji: Emoji
325
+ content: string
326
+ icon: string
327
+ notify_type: number
328
+ region: string
329
+ enable_open: number
330
+ openId: number
331
+ default_channel_id: string
332
+ welcome_channel_id: string
333
+ updated_at: number
334
+ joined_at: number
335
+ exited_at: number
336
+ deleted_at: number
337
+ nickname: string
338
+ chat_code: string
339
+ event_time: number
340
+ guilds: string[]
341
+ }
342
+
343
+ export interface ChannelRoleIndex {
344
+ permission_overwrites: Overwrite
345
+ permission_users: List<User>
346
+ permission_sync: 0 | 1
347
+ }
348
+
349
+ export interface ChannelRole {
350
+ user_id?: string
351
+ role_id?: string
352
+ allow: number
353
+ deny: number
354
+ }
355
+
356
+ export interface Emoji {
357
+ id: string
358
+ name: string
359
+ }
360
+
361
+ export interface Overwrite {
362
+ role_id: number
363
+ allow: number
364
+ deny: number
365
+ }
366
+
367
+ export interface ListMeta {
368
+ page: number
369
+ page_total: number
370
+ page_size: number
371
+ total: number
372
+ }
373
+
374
+ export interface List<T> {
375
+ items: T[]
376
+ meta: ListMeta
377
+ sort: Partial<Record<keyof T, number>>
378
+ }
379
+
380
+ export interface Guild {
381
+ id: string
382
+ name: string
383
+ topic: string
384
+ master_id: string
385
+ is_master: boolean
386
+ icon: string
387
+ invite_enabled: number
388
+ notify_type: number
389
+ region: string
390
+ enable_open: number
391
+ openId: string
392
+ default_channel_id: string
393
+ welcome_channel_id: string
394
+ }
395
+
396
+ export interface GuildList extends List<Guild> {}
397
+
398
+ export interface GuildUser extends User {
399
+ joined_at: number
400
+ active_time: number
401
+ is_master: boolean
402
+ abbr: string
403
+ }
404
+
405
+ export interface GuildUserList extends List<GuildUser> {
406
+ user_count: number
407
+ online_count: number
408
+ offline_count: number
409
+ }
410
+
411
+ interface Pagination {
412
+ page?: number
413
+ page_size?: number
414
+ sort?: string[]
415
+ }
416
+
417
+ interface GuildMute {
418
+ type: GuildMute.Type
419
+ user_ids: string[]
420
+ }
421
+
422
+ export interface GuildRole {
423
+ role_id: number
424
+ name: string
425
+ color: number
426
+ position: number
427
+ hoist: 0 | 1
428
+ mentionable: 0 | 1
429
+ permissions: number
430
+ }
431
+
432
+ export interface GuildRoleReturn {
433
+ user_id: string
434
+ guild_id: string
435
+ roles: number[]
436
+ }
437
+
438
+ export enum Permissions {
439
+ GUILD_ADMIN = 0,
440
+ GUILD_MANAGE = 1,
441
+ GUILD_LOG = 2,
442
+ GUILD_INVITE_CREATE = 3,
443
+ GUILD_INVITE_MANAGE = 4,
444
+ CHANNEL_MANAGE = 5,
445
+ GUILD_USER_KICK = 6,
446
+ GUILD_USER_BAN = 7,
447
+ GUILD_EMOJI_MANAGE = 8,
448
+ GUILD_USER_NAME_CHANGE = 9,
449
+ GUILD_ROLE_MANAGE = 10,
450
+ CHANNEL_VIEW = 11,
451
+ CHANNEL_MESSAGE = 12,
452
+ CHANNEL_MANAGE_MESSAGE = 13,
453
+ CHANNEL_UPLOAD = 14,
454
+ CHANNEL_VOICE_CONNECT = 15,
455
+ CHANNEL_VOICE_MANAGE = 16,
456
+ CHANNEL_MESSAGE_AT_ALL = 17,
457
+ CHANNEL_MESSAGE_REACTION_CREATE = 18,
458
+ CHANNEL_MESSAGE_REACTION_FOLLOW = 19,
459
+ CHANNEL_VOICE_CONNECT_PASSIVE = 20,
460
+ CHANNEL_VOICE_SPEAK_KEY_ONLY = 21,
461
+ CHANNEL_VOICR_SPEAK_FREE = 22,
462
+ CHANNEL_VOICE_SPEAK = 23,
463
+ GUILD_USER_DEAFEN = 24,
464
+ GUILD_USER_MUTEGUILD_USER_NAME_CHANGE_OTHER = 25,
465
+ GUILD_USER_NAME_CHANGE_OTHER = 26,
466
+ CHANNEL_VOICE_BGM = 27,
467
+ }
468
+
469
+ export function hasPermission(permissions: number, permission: Permissions) {
470
+ return (permissions & (1 << permission)) === (1 << permission)
471
+ }
472
+
473
+ export namespace GuildMute {
474
+ export enum Type {
475
+ mic = 1,
476
+ headset = 2,
477
+ }
478
+ }
479
+
480
+ export interface GuildMuteList {
481
+ mic: GuildMute
482
+ headset: GuildMute
483
+ }
484
+
485
+ export interface GuildBoost {
486
+ user_id: string
487
+ guild_id: string
488
+ start_time: number
489
+ end_time: number
490
+ user: User
491
+ }
492
+
493
+ export interface Game {
494
+ id: number
495
+ name: string
496
+ type: 0 | 1 | 2
497
+ options: string
498
+ kmhook_admin: boolean
499
+ process_name: string[]
500
+ product_name: string[]
501
+ icon: string
502
+ }
503
+
504
+ export interface AccessToken {
505
+ access_token: string
506
+ expires_in?: number
507
+ token_type: 'Bearer'
508
+ scope: string
509
+ }
510
+
511
+ export interface Intimacy {
512
+ img_url: string
513
+ social_info: string
514
+ last_read: number
515
+ score: number
516
+ img_list: {
517
+ id: string
518
+ url: string
519
+ }[]
520
+ }
521
+
522
+ export interface Invite {
523
+ guild_id: string
524
+ channel_id: string
525
+ url_code: string
526
+ url: string
527
+ user: User
528
+ }
529
+
530
+ export interface BlackList {
531
+ user_id: string
532
+ created_time: number
533
+ remark: string
534
+ user: User
535
+ }
536
+
537
+ export interface Internal {
538
+ getGuildList(param?: Pagination): Promise<List<Guild>>
539
+ getGuildView(param: { guild_id: string }): Promise<Guild>
540
+ getGuildUserList(param: { guild_id: string } & Pagination): Promise<GuildUserList>
541
+ setGuildUserNickname(param: { guild_id: string; user_id: string; nickname: string }): Promise<void>
542
+ leaveGuild(param: { guild_id: string }): Promise<void>
543
+ kickoutGuildUser(param: { guild_id: string; target_id: string }): Promise<void>
544
+ getGuildMuteList(param: { guild_id: string }): Promise<GuildMuteList>
545
+ createGuildMute(param: { guild_id: string; user_id: string; type: GuildMute.Type }): Promise<void>
546
+ deleteGuildMute(param: { guild_id: string; user_id: string; type: GuildMute.Type }): Promise<void>
547
+ getGuildBoostHistory(param: { guild_id: string; start_time: number; end_time: number }): Promise<List<GuildBoost>>
548
+
549
+ getChannelList(param: { guild_id: string } & Pagination): Promise<List<Channel>>
550
+ getChannelView(param: { target_id: string }): Promise<Channel>
551
+ createChannel(param: { guild_id: string; parent_id?: string; name: string; type?: number; limit_amount?: number; voice_quality?: string; is_category?: 0|1 }): Promise<Channel>
552
+ updateChannel(param: { channel_id: string; name?: string; topic?: string; slow_mode?: 0|5000|10000|15000|30000|60000|120000|300000|600000|900000|1800000|3600000|7200000|21600000 }): Promise<Channel>
553
+ deleteChannel(param: { channel_id: string }): Promise<void>
554
+ getChannelUserList(param: { channel_id: string }): Promise<List<User>>
555
+ kickChannelUser(param: { channel_id: string; user_id: string}): Promise<void>
556
+ moveChannelUser(param: { target_id: string; user_ids: [] }): Promise<void>
557
+ getChannelRoleIndex(param: { channel_id: string }): Promise<ChannelRoleIndex>
558
+ createChannelRole(param: { channel_id: string; type?: 'user_id'; value?: string }): Promise<Omit<ChannelRole, 'role_id'>>
559
+ createChannelRole(param: { channel_id: string; type: 'role_id'; value?: string }): Promise<Omit<ChannelRole, 'user_id'>>
560
+ updateChannelRole(param: { channel_id: string; type?: 'user_id'; value?: string; allow?: number; deny?: number }): Promise<Omit<ChannelRole, 'role_id'>>
561
+ updateChannelRole(param: { channel_id: string; type: 'role_id'; value?: string; allow?: number; deny?: number }): Promise<Omit<ChannelRole, 'user_id'>>
562
+ deleteChannelRole(param: { channel_id: string; type?: 'role_id' | 'user_id'; value?: string }): Promise<void>
563
+
564
+ getMessageList(param: { target_id: string; msg_id?: string; pin?: 0 | 1; flag?: 'before' | 'around' | 'after' } & Pagination): Promise<List<Message>>
565
+ getMessageView(param: { msg_id: string }): Promise<Message>
566
+ createMessage(param: { type?: Type; target_id: string; content: string; quote?: string; nonce?: string; temp_target_id?: string }): Promise<MessageReturn>
567
+ updateMessage(param: { msg_id: string; content: string; quote?: string; temp_target_id?: string }): Promise<void>
568
+ deleteMessage(param: { msg_id: string }): Promise<void>
569
+ getMessageReactionList(param: { msg_id: string; emoji: string }): Promise<User[]>
570
+ addMessageReaction(param: { msg_id: string; emoji: string }): Promise<void>
571
+ deleteMessageReaction(param: { msg_id: string; emoji: string; user_id?: string}): Promise<void>
572
+
573
+ getChannelJoinedUserList(param: { guild_id: string; user_id: string } & Pagination): Promise<List<Channel>>
574
+
575
+ getPrivateChatList(param?: Pagination): Promise<List<Omit<PrivateChat, 'is_friend' | 'is_blocked' | 'is_target_blocked'>>>
576
+ getPrivateChatView(param: { chat_code: string }): Promise<PrivateChat>
577
+ createPrivateChat(param: { target_id: string }): Promise<PrivateChat>
578
+ deletePrivateChat(param: { chat_code: string }): Promise<void>
579
+
580
+ getDirectMessageList(param: { target_id?: string; chat_code?: string; msg_id?: string; flag?: 'before' | 'around' | 'after' } & Pagination): Promise<{ items: Message[] }>
581
+ createDirectMessage(param: { target_id?: string; chat_code?: string; type?: Type; content: string; quote?: string; nonce?: string}): Promise<MessageReturn>
582
+ updateDirectMessage(param: { msg_id: string; content: string; quote?: string}): Promise<void>
583
+ deleteDirectMessage(param: { msg_id: string }): Promise<void>
584
+ getDirectMessageReactionList(param: { msg_id: string; emoji?: string}): Promise<User[]>
585
+ addDirectMessageReaction(param: { msg_id: string; emoji: string }): Promise<void>
586
+ deleteDirectMessageReaction(param: { msg_id: string; emoji: string; user_id?: string }): Promise<void>
587
+
588
+ getGateway(param: { compress?: 0|1 }): Promise<{ url: string }>
589
+ getToken(param: { grant_type: 'authorization_code'; client_id: string; client_secret: string; code: string; redirect_uri: string}): Promise<AccessToken>
590
+ // createAsset(param: { file: FormData }): Promise<{ url: string }>
591
+
592
+ getUserMe(): Promise<User>
593
+ getUserView(param: { user_id: string; guild_id?: string }): Promise<User>
594
+ offline(): Promise<void>
595
+
596
+ getGuildRoleList(param: { guild_id: string } & Pagination): Promise<List<GuildRole>>
597
+ createGuildRole(param: { name?: string; guild_id: string }): Promise<GuildRole>
598
+ updateGuildRole(param: { guild_id: string; role_id: number } & Partial<Omit<GuildRole, 'role_id'>>): Promise<GuildRole>
599
+ deleteGuildRole(param: { guild_id: string; role_id: number }): Promise<void>
600
+ grantGuildRole(param: { guild_id: string; user_id?: string; role_id: number }): Promise<GuildRoleReturn>
601
+ revokeGuildRole(param: { guild_id: string; user_id?: string; role_id: number }): Promise<GuildRoleReturn>
602
+
603
+ getIntimacy(param: { user_id: string }): Promise<Intimacy>
604
+ updateIntimacy(param: { user_id: string; score?: number; social_info?: string; img_id?: string }): Promise<void>
605
+
606
+ getGuildEmojiList(param?: Pagination): Promise<List<Emoji>>
607
+ // createGuildEmoji(param: { name?: string; guild_id: string; emoji: FormData }): Promise<Emoji>
608
+ updateGuildEmoji(param: { name: string; id: string }): Promise<void>
609
+ deleteGuildEmoji(param: { id: string }): Promise<void>
610
+
611
+ getInviteList(param: { guild_id?: string; channel_id?: string } & Pagination): Promise<List<Invite>>
612
+ createInvite(param: { guild_id?: string; channel_id?: string; duration?: number; setting_times?: number }): Promise<{ url: string }>
613
+ deleteInvite(param: { url_code: string; guild_id?: string; channel_id?: string }): Promise<void>
614
+
615
+ getBlacklist(param: { guild_id: string } & Pagination): Promise<List<BlackList>>
616
+ createBlacklist(param: { guild_id: string; target_id: string; remark?: string; del_msg_days?: 0|1|2|3|4|5|6|7 }): Promise<void>
617
+ deleteBlacklist(param: { guild_id: string; target_id: string }): Promise<void>
618
+
619
+ // getGuildBadge(param: { guild_id: string; style?: 0|1|2 }): Promise<void> // 未实现
620
+ getGameList(param?: { type?: 0 | 1 | 2 }): Promise<List<Game>>
621
+ createGame(param: { name: string; icon?: string }): Promise<List<Game>>
622
+ updateGame(param: { id: number; name?: string; icon?: string }): Promise<List<Game>>
623
+ deleteGame(param: { id: number }): Promise<void>
624
+ createGameActivity(param: { id: number; data_type: 1|2; software?: 'cloudmusic'|'qqmusic'|'kugou'; singer?: string; music_name?: string}): Promise<void>
625
+ deleteGameActivity(param: { data_type: 1|2 }): Promise<void>
626
+
627
+ hasPermission(permissions: number, permission: Permissions): boolean
628
+ }
629
+
630
+ export interface Events {
631
+ 'kook/updated-message'(input: any, bot: KookBot): void
632
+ 'kook/updated-private-message'(input: any, bot: KookBot): void
633
+ 'kook/deleted-message'(input: any, bot: KookBot): void
634
+ 'kook/deleted-private-message'(input: any, bot: KookBot): void
635
+ 'kook/added-reaction'(input: any, bot: KookBot): void
636
+ 'kook/private-added-reaction'(input: any, bot: KookBot): void
637
+ 'kook/deleted-reaction'(input: any, bot: KookBot): void
638
+ 'kook/private-deleted-reaction'(input: any, bot: KookBot): void
639
+ 'kook/updated-channel'(input: any, bot: KookBot): void
640
+ 'kook/deleted-channel'(input: any, bot: KookBot): void
641
+ 'kook/pinned-message'(input: any, bot: KookBot): void
642
+ 'kook/unpinned-message'(input: any, bot: KookBot): void
643
+ 'kook/joined-guild'(input: any, bot: KookBot): void
644
+ 'kook/exited-guild'(input: any, bot: KookBot): void
645
+ 'kook/updated-guild'(input: any, bot: KookBot): void
646
+ 'kook/deleted-guild'(input: any, bot: KookBot): void
647
+ 'kook/self-joined-guild'(input: any, bot: KookBot): void
648
+ 'kook/self-exited-guild'(input: any, bot: KookBot): void
649
+ 'kook/update-guild-member'(input: any, bot: KookBot): void
650
+ 'kook/guild-member-online'(input: any, bot: KookBot): void
651
+ 'kook/guild-member-offline'(input: any, bot: KookBot): void
652
+ 'kook/added-role'(input: any, bot: KookBot): void
653
+ 'kook/deleted-role'(input: any, bot: KookBot): void
654
+ 'kook/updated-role'(input: any, bot: KookBot): void
655
+ 'kook/added-block-list'(input: any, bot: KookBot): void
656
+ 'kook/deleted-block-list'(input: any, bot: KookBot): void
657
+ 'kook/added-emoji'(input: any, bot: KookBot): void
658
+ 'kook/updated-emoji'(input: any, bot: KookBot): void
659
+ 'kook/joined-channel'(input: any, bot: KookBot): void
660
+ 'kook/exited-channel'(input: any, bot: KookBot): void
661
+ 'kook/user-updated'(input: any, bot: KookBot): void
662
+ 'kook/message-btn-click'(input: any, bot: KookBot): void
663
+ }
664
+
665
+ export class Internal {
666
+ constructor(private readonly request: KookRequest) {}
667
+
668
+ static define(name: string, method: string, path: string) {
669
+ Object.defineProperty(Internal.prototype, name, {
670
+ configurable: true,
671
+ writable: true,
672
+ value: async function (this: Internal, payload?: object) {
673
+ return await invoke(this.request, method, path, payload)
674
+ },
675
+ })
676
+ }
677
+ }
678
+
679
+ Internal.define('getGuildList', 'GET', '/guild/list')
680
+ Internal.define('getGuildView', 'GET', '/guild/view')
681
+ Internal.define('getGuildUserList', 'GET', '/guild/user-list')
682
+ Internal.define('setGuildUserNickname', 'POST', '/guild/nickname')
683
+ Internal.define('leaveGuild', 'POST', '/guild/leave')
684
+ Internal.define('kickoutGuildUser', 'POST', '/guild/kickout')
685
+ Internal.define('getGuildMuteList', 'GET', '/guild-mute/list')
686
+ Internal.define('createGuildMute', 'POST', '/guild-mute/create')
687
+ Internal.define('deleteGuildMute', 'POST', '/guild-mute/delete')
688
+ Internal.define('getGuildBoostHistory', 'GET', '/guild-boost/history')
689
+
690
+ Internal.define('getChannelList', 'GET', '/channel/list')
691
+ Internal.define('getChannelView', 'GET', '/channel/view')
692
+ Internal.define('createChannel', 'POST', '/channel/create')
693
+ Internal.define('updateChannel', 'POST', '/channel/update')
694
+ Internal.define('deleteChannel', 'POST', '/channel/delete')
695
+ Internal.define('getChannelUserList', 'GET', '/channel/user-list')
696
+ Internal.define('kickChannelUser', 'POST', '/channel/kickout')
697
+ Internal.define('moveChannelUser', 'POST', '/channel/move-user')
698
+ Internal.define('getChannelRoleIndex', 'GET', '/channel-role/index')
699
+ Internal.define('createChannelRole', 'POST', '/channel-role/create')
700
+ Internal.define('updateChannelRole', 'POST', '/channel-role/update')
701
+ Internal.define('deleteChannelRole', 'POST', '/channel-role/delete')
702
+
703
+ Internal.define('getMessageList', 'GET', '/message/list')
704
+ Internal.define('getMessageView', 'GET', '/message/view')
705
+ Internal.define('createMessage', 'POST', '/message/create')
706
+ Internal.define('updateMessage', 'POST', '/message/update')
707
+ Internal.define('deleteMessage', 'POST', '/message/delete')
708
+ Internal.define('getMessageReactionList', 'GET', '/message/reaction-list')
709
+ Internal.define('addMessageReaction', 'POST', '/message/add-reaction')
710
+ Internal.define('deleteMessageReaction', 'POST', '/message/delete-reaction')
711
+
712
+ Internal.define('getChannelJoinedUserList', 'GET', '/channel-user/get-joined-channel')
713
+
714
+ Internal.define('getPrivateChatList', 'GET', '/user-chat/list')
715
+ Internal.define('getPrivateChatView', 'GET', '/user-chat/view')
716
+ Internal.define('createPrivateChat', 'POST', '/user-chat/create')
717
+ Internal.define('deletePrivateChat', 'POST', '/user-chat/delete')
718
+
719
+ Internal.define('getDirectMessageList', 'GET', '/direct-message/list')
720
+ Internal.define('createDirectMessage', 'POST', '/direct-message/create')
721
+ Internal.define('updateDirectMessage', 'POST', '/direct-message/update')
722
+ Internal.define('deleteDirectMessage', 'POST', '/direct-message/delete')
723
+ Internal.define('getDirectMessageReactionList', 'GET', '/direct-message/reaction-list')
724
+ Internal.define('addDirectMessageReaction', 'POST', '/direct-message/add-reaction')
725
+ Internal.define('deleteDirectMessageReaction', 'POST', '/direct-message/delete-reaction')
726
+
727
+ Internal.define('getGateway', 'GET', '/gateway/index')
728
+ Internal.define('getToken', 'POST', '/oauth2/token')
729
+ Internal.define('createAsset', 'POST', '/asset/create')
730
+
731
+ Internal.define('getUserMe', 'GET', '/user/me')
732
+ Internal.define('getUserView', 'GET', '/user/view')
733
+ Internal.define('offline', 'POST', '/user/offline')
734
+
735
+ Internal.define('getGuildRoleList', 'GET', '/guild-role/list')
736
+ Internal.define('createGuildRole', 'POST', '/guild-role/create')
737
+ Internal.define('updateGuildRole', 'POST', '/guild-role/update')
738
+ Internal.define('deleteGuildRole', 'POST', '/guild-role/delete')
739
+ Internal.define('grantGuildRole', 'POST', '/guild-role/grant')
740
+ Internal.define('revokeGuildRole', 'POST', '/guild-role/revoke')
741
+
742
+ Internal.define('getIntimacy', 'GET', '/intimacy/index')
743
+ Internal.define('updateIntimacy', 'POST', '/intimacy/update')
744
+
745
+ Internal.define('getGuildEmojiList', 'GET', '/guild-emoji/list')
746
+ Internal.define('createGuildEmoji', 'POST', '/guild-emoji/create')
747
+ Internal.define('updateGuildEmoji', 'POST', '/guild-emoji/update')
748
+ Internal.define('deleteGuildEmoji', 'POST', '/guild-emoji/delete')
749
+
750
+ Internal.define('getInviteList', 'GET', '/invite/list')
751
+ Internal.define('createInvite', 'POST', '/invite/create')
752
+ Internal.define('deleteInvite', 'POST', '/invite/delete')
753
+
754
+ Internal.define('getBlacklist', 'GET', '/blacklist/list')
755
+ Internal.define('createBlacklist', 'POST', '/blacklist/create')
756
+ Internal.define('deleteBlacklist', 'POST', '/blacklist/delete')
757
+
758
+ Internal.define('getGuildBadge', 'GET', '/badge/guild')
759
+ Internal.define('getGameList', 'GET', '/game')
760
+ Internal.define('createGame', 'POST', '/game/create')
761
+ Internal.define('updateGame', 'POST', '/game/update')
762
+ Internal.define('deleteGame', 'POST', '/game/delete')
763
+ Internal.define('createGameActivity', 'POST', '/game/activity')
764
+ Internal.define('deleteGameActivity', 'POST', '/game/delete-activity')