@koishijs/plugin-adapter-discord 2.0.0-beta.7 → 2.0.1

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.
@@ -4,7 +4,7 @@ export interface Channel {
4
4
  /** the id of this channel */
5
5
  id: snowflake;
6
6
  /** the type of channel */
7
- type: integer;
7
+ type: Channel.Type;
8
8
  /** the id of the guild (may be missing for some channel objects received over gateway guild dispatches) */
9
9
  guild_id?: snowflake;
10
10
  /** sorting position of the channel */
@@ -41,43 +41,158 @@ export interface Channel {
41
41
  rtc_region?: string;
42
42
  /** the camera video quality mode of the voice channel, 1 when not present */
43
43
  video_quality_mode?: integer;
44
- /** an approximate count of messages in a thread, stops counting at 50 */
45
- message_count?: integer;
46
- /** an approximate count of users in a thread, stops counting at 50 */
47
- member_count?: integer;
48
- /** thread-specific fields not needed by other channels */
49
- thread_metadata?: ThreadMetadata;
50
- /** thread member object for the current user, if they have joined the thread, only included on certain API endpoints */
51
- member?: ThreadMember;
52
- /** default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
53
- default_auto_archive_duration?: integer;
54
44
  /** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction */
55
45
  permissions?: string;
56
46
  }
57
- /** https://discord.com/developers/docs/resources/channel#channel-object-channel-types */
58
- export declare enum ChannelType {
59
- /** a text channel within a server */
60
- GUILD_TEXT = 0,
61
- /** a direct message between users */
62
- DM = 1,
63
- /** a voice channel within a server */
64
- GUILD_VOICE = 2,
65
- /** a direct message between multiple users */
66
- GROUP_DM = 3,
67
- /** an organizational category that contains up to 50 channels */
68
- GUILD_CATEGORY = 4,
69
- /** a channel that users can follow and crosspost into their own server */
70
- GUILD_NEWS = 5,
71
- /** a channel in which game developers can sell their game on Discord */
72
- GUILD_STORE = 6,
73
- /** a temporary sub-channel within a GUILD_NEWS channel */
74
- GUILD_NEWS_THREAD = 10,
75
- /** a temporary sub-channel within a GUILD_TEXT channel */
76
- GUILD_PUBLIC_THREAD = 11,
77
- /** a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */
78
- GUILD_PRIVATE_THREAD = 12,
79
- /** a voice channel for hosting events with an audience */
80
- GUILD_STAGE_VOICE = 13
47
+ export declare namespace Channel {
48
+ /** https://discord.com/developers/docs/resources/channel#channel-object-channel-types */
49
+ enum Type {
50
+ /** a text channel within a server */
51
+ GUILD_TEXT = 0,
52
+ /** a direct message between users */
53
+ DM = 1,
54
+ /** a voice channel within a server */
55
+ GUILD_VOICE = 2,
56
+ /** a direct message between multiple users */
57
+ GROUP_DM = 3,
58
+ /** an organizational category that contains up to 50 channels */
59
+ GUILD_CATEGORY = 4,
60
+ /** a channel that users can follow and crosspost into their own server */
61
+ GUILD_NEWS = 5,
62
+ /** a channel in which game developers can sell their game on Discord */
63
+ GUILD_STORE = 6,
64
+ /** a temporary sub-channel within a GUILD_NEWS channel */
65
+ GUILD_NEWS_THREAD = 10,
66
+ /** a temporary sub-channel within a GUILD_TEXT channel */
67
+ GUILD_PUBLIC_THREAD = 11,
68
+ /** a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */
69
+ GUILD_PRIVATE_THREAD = 12,
70
+ /** a voice channel for hosting events with an audience */
71
+ GUILD_STAGE_VOICE = 13
72
+ }
73
+ namespace Params {
74
+ /** https://discord.com/developers/docs/resources/user#create-dm-json-params */
75
+ interface CreateDM {
76
+ /** the recipient to open a DM channel with */
77
+ recipient_id: snowflake;
78
+ }
79
+ /** https://discord.com/developers/docs/resources/user#create-group-dm-json-params */
80
+ interface CreateGroupDM {
81
+ /** access tokens of users that have granted your app the gdm.join scope */
82
+ access_tokens: string[];
83
+ /** a dictionary of user ids to their respective nicknames */
84
+ nicks: Record<string, string>;
85
+ }
86
+ /** https://discord.com/developers/docs/resources/guild#create-guild-channel-json-params */
87
+ interface Create {
88
+ /** channel name (1-100 characters) */
89
+ name: string;
90
+ /** the type of channel */
91
+ type: integer;
92
+ /** channel topic (0-1024 characters) */
93
+ topic: string;
94
+ /** the bitrate (in bits) of the voice channel (voice only) */
95
+ bitrate: integer;
96
+ /** the user limit of the voice channel (voice only) */
97
+ user_limit: integer;
98
+ /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected */
99
+ rate_limit_per_user: integer;
100
+ /** sorting position of the channel */
101
+ position: integer;
102
+ /** the channel's permission overwrites */
103
+ permission_overwrites: Overwrite[];
104
+ /** id of the parent category for a channel */
105
+ parent_id: snowflake;
106
+ /** whether the channel is nsfw */
107
+ nsfw: boolean;
108
+ }
109
+ /** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions-json-params */
110
+ interface ModifyPositions {
111
+ /** channel id */
112
+ id: snowflake;
113
+ /** sorting position of the channel */
114
+ position?: integer;
115
+ /** syncs the permission overwrites with the new parent, if moving to a new category */
116
+ lock_permissions?: boolean;
117
+ /** the new parent ID for the channel that is moved */
118
+ parent_id?: snowflake;
119
+ }
120
+ type Modify = Modify.GroupDM | Modify.GuildChannel | Modify.Thread;
121
+ namespace Modify {
122
+ /** https://discord.com/developers/docs/resources/channel#modify-channel-json-params-group-dm */
123
+ interface GroupDM {
124
+ /** 1-100 character channel name */
125
+ name: string;
126
+ /** base64 encoded icon */
127
+ icon: string;
128
+ }
129
+ /** https://discord.com/developers/docs/resources/channel#modify-channel-json-params-guild-channel */
130
+ interface GuildChannel {
131
+ /** 1-100 character channel name */
132
+ name: string;
133
+ /** the type of channel; only conversion between text and news is supported and only in guilds with the "NEWS" feature */
134
+ type: integer;
135
+ /** the position of the channel in the left-hand listing */
136
+ position?: integer;
137
+ /** 0-1024 character channel topic */
138
+ topic?: string;
139
+ /** whether the channel is nsfw */
140
+ nsfw?: boolean;
141
+ /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected */
142
+ rate_limit_per_user?: integer;
143
+ /** the bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers) */
144
+ bitrate?: integer;
145
+ /** the user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit */
146
+ user_limit?: integer;
147
+ /** channel or category-specific permissions */
148
+ permission_overwrites?: Overwrite[];
149
+ /** id of the new parent category for a channel */
150
+ parent_id?: snowflake;
151
+ /** channel voice region id, automatic when set to null */
152
+ rtc_region?: string;
153
+ /** the camera video quality mode of the voice channel */
154
+ video_quality_mode?: integer;
155
+ /** the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity */
156
+ default_auto_archive_duration?: integer;
157
+ }
158
+ /** https://discord.com/developers/docs/resources/channel#modify-channel-json-params-thread */
159
+ interface Thread {
160
+ /** 1-100 character channel name */
161
+ name: string;
162
+ /** whether the thread is archived */
163
+ archived: boolean;
164
+ /** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
165
+ auto_archive_duration: integer;
166
+ /** whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it */
167
+ locked: boolean;
168
+ /** whether non-moderators can add other non-moderators to a thread; only available on private threads */
169
+ invitable: boolean;
170
+ /** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages, manage_thread, or manage_channel, are unaffected */
171
+ rate_limit_per_user?: integer;
172
+ }
173
+ }
174
+ /** https://discord.com/developers/docs/resources/channel#edit-channel-permissions-json-params */
175
+ interface EditPermissions {
176
+ /** the bitwise value of all allowed permissions */
177
+ allow: string;
178
+ /** the bitwise value of all disallowed permissions */
179
+ deny: string;
180
+ /** 0 for a role or 1 for a member */
181
+ type: integer;
182
+ }
183
+ /** https://discord.com/developers/docs/resources/channel#follow-news-channel-json-params */
184
+ interface Follow {
185
+ /** id of target channel */
186
+ webhook_channel_id: snowflake;
187
+ }
188
+ /** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient-json-params */
189
+ interface AddRecipient {
190
+ /** access token of a user that has granted your app the gdm.join scope */
191
+ access_token: string;
192
+ /** nickname of the user being added */
193
+ nick: string;
194
+ }
195
+ }
81
196
  }
82
197
  /** https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure */
83
198
  export interface FollowedChannel {
@@ -97,30 +212,6 @@ export interface Overwrite {
97
212
  /** permission bit set */
98
213
  deny: string;
99
214
  }
100
- /** https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure */
101
- export interface ThreadMetadata {
102
- /** whether the thread is archived */
103
- archived: boolean;
104
- /** duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
105
- auto_archive_duration: integer;
106
- /** timestamp when the thread's archive status was last changed, used for calculating recent activity */
107
- archive_timestamp: timestamp;
108
- /** whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it */
109
- locked: boolean;
110
- /** whether non-moderators can add other non-moderators to a thread; only available on private threads */
111
- invitable?: boolean;
112
- }
113
- /** https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure */
114
- export interface ThreadMember {
115
- /** the id of the thread */
116
- id?: snowflake;
117
- /** the id of the user */
118
- user_id?: snowflake;
119
- /** the time the current user last joined the thread */
120
- join_timestamp: timestamp;
121
- /** any user-thread settings, currently only used for notifications */
122
- flags: integer;
123
- }
124
215
  /** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */
125
216
  export declare enum AllowedMentionType {
126
217
  /** Controls role mentions */
@@ -156,32 +247,6 @@ export interface ChannelPinsUpdateEvent {
156
247
  /** the time at which the most recent pinned message was pinned */
157
248
  last_pin_timestamp?: timestamp;
158
249
  }
159
- /** https://discord.com/developers/docs/topics/gateway#thread-list-sync-thread-list-sync-event-fields */
160
- export interface ThreadListSyncEvent {
161
- /** the id of the guild */
162
- guild_id: snowflake;
163
- /** the parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data. */
164
- channel_ids?: snowflake[];
165
- /** all active threads in the given channels that the current user can access */
166
- threads: Channel[];
167
- /** all thread member objects from the synced threads for the current user, indicating which threads the current user has been added to */
168
- members: ThreadMember[];
169
- }
170
- export interface ThreadMemberUpdateEvent extends ThreadMember {
171
- }
172
- /** https://discord.com/developers/docs/topics/gateway#thread-members-update-thread-members-update-event-fields */
173
- export interface ThreadMembersUpdateEvent {
174
- /** the id of the thread */
175
- id: snowflake;
176
- /** the id of the guild */
177
- guild_id: snowflake;
178
- /** the approximate number of members in the thread, capped at 50 */
179
- member_count: integer;
180
- /** the users who were added to the thread */
181
- added_members?: ThreadMember[];
182
- /** the id of the users who were removed from the thread */
183
- removed_member_ids?: snowflake[];
184
- }
185
250
  /** https://discord.com/developers/docs/topics/gateway#typing-start-typing-start-event-fields */
186
251
  export interface TypingStartEvent {
187
252
  /** id of the channel */
@@ -205,12 +270,6 @@ declare module './gateway' {
205
270
  CHANNEL_DELETE: ChannelDeleteEvent;
206
271
  /** message was pinned or unpinned */
207
272
  CHANNEL_PINS_UPDATE: ChannelPinsUpdateEvent;
208
- /** sent when gaining access to a channel, contains all active threads in that channel */
209
- THREAD_LIST_SYNC: ThreadListSyncEvent;
210
- /** thread member for the current user was updated */
211
- THREAD_MEMBER_UPDATE: ThreadMemberUpdateEvent;
212
- /** some user(s) were added to or removed from a thread */
213
- THREAD_MEMBERS_UPDATE: ThreadMembersUpdateEvent;
214
273
  /** user started typing in a channel */
215
274
  TYPING_START: TypingStartEvent;
216
275
  }
@@ -227,21 +286,83 @@ export interface ChannelPosition {
227
286
  }
228
287
  declare module './internal' {
229
288
  interface Internal {
230
- /** https://discord.com/developers/docs/resources/guild#get-guild-channels */
289
+ /**
290
+ * Create a new DM channel with a user. Returns a DM channel object.
291
+ * @see https://discord.com/developers/docs/resources/user#create-dm
292
+ */
293
+ createDM(params: Channel.Params.CreateDM): Promise<void>;
294
+ /**
295
+ * Create a new group DM channel with multiple users. Returns a DM channel object. This endpoint was intended to be used with the now-deprecated GameBridge SDK. DMs created with this endpoint will not be shown in the Discord client
296
+ * @see https://discord.com/developers/docs/resources/user#create-group-dm
297
+ */
298
+ createGroupDM(params: Channel.Params.CreateGroupDM): Promise<void>;
299
+ }
300
+ }
301
+ declare module './internal' {
302
+ interface Internal {
303
+ /**
304
+ * Returns a list of guild channel objects. Does not include threads.
305
+ * @see https://discord.com/developers/docs/resources/guild#get-guild-channels
306
+ */
231
307
  getGuildChannels(guild_id: snowflake): Promise<Channel[]>;
232
- /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
233
- createGuildChannel(guild_id: snowflake, options: Partial<Channel>): Promise<Channel>;
234
- /** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
235
- modifyGuildChannelPositions(guild_id: snowflake, positions: ChannelPosition[]): Promise<void>;
308
+ /**
309
+ * Create a new channel object for the guild. Requires the MANAGE_CHANNELS permission. If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. Setting MANAGE_ROLES permission in channels is only possible for guild administrators. Returns the new channel object on success. Fires a Channel Create Gateway event.
310
+ * @see https://discord.com/developers/docs/resources/guild#create-guild-channel
311
+ */
312
+ createGuildChannel(guild_id: snowflake, params: Channel.Params.Create): Promise<Channel>;
313
+ /**
314
+ * Modify the positions of a set of channel objects for the guild. Requires MANAGE_CHANNELS permission. Returns a 204 empty response on success. Fires multiple Channel Update Gateway events.
315
+ * @see https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
316
+ */
317
+ modifyGuildChannelPositions(guild_id: snowflake, params: Channel.Params.ModifyPositions): Promise<void>;
236
318
  }
237
319
  }
238
320
  declare module './internal' {
239
321
  interface Internal {
240
- /** https://discord.com/developers/docs/resources/channel#get-channel */
241
- getChannel(channel_id: string): Promise<Channel>;
242
- /** https://discord.com/developers/docs/resources/channel#modify-channel */
243
- modifyChannel(channel_id: string, data: Partial<Channel>): Promise<Channel>;
244
- /** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
245
- deleteChannel(channel_id: string): Promise<Channel>;
322
+ /**
323
+ * Get a channel by ID. Returns a channel object. If the channel is a thread, a thread member object is included in the returned result.
324
+ * @see https://discord.com/developers/docs/resources/channel#get-channel
325
+ */
326
+ getChannel(channel_id: snowflake): Promise<Channel>;
327
+ /**
328
+ * Update a channel's settings. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. All JSON parameters are optional.
329
+ * @see https://discord.com/developers/docs/resources/channel#modify-channel
330
+ */
331
+ modifyChannel(channel_id: snowflake, params: Channel.Params.Modify): Promise<Channel>;
332
+ /**
333
+ * Delete a channel, or close a private message. Requires the MANAGE_CHANNELS permission for the guild, or MANAGE_THREADS if the channel is a thread. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update Gateway event will fire for each of them. Returns a channel object on success. Fires a Channel Delete Gateway event (or Thread Delete if the channel was a thread).
334
+ * @see https://discord.com/developers/docs/resources/channel#deleteclose-channel
335
+ */
336
+ deleteChannel(channel_id: snowflake): Promise<Channel>;
337
+ /**
338
+ * Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel). Returns a 204 empty response on success. For more information about permissions, see permissions.
339
+ * @see https://discord.com/developers/docs/resources/channel#edit-channel-permissions
340
+ */
341
+ editChannelPermissions(channel_id: snowflake, overwrite_id: string, params: Channel.Params.EditPermissions): Promise<void>;
342
+ /**
343
+ * Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. For more information about permissions, see permissions
344
+ * @see https://discord.com/developers/docs/resources/channel#delete-channel-permission
345
+ */
346
+ deleteChannelPermission(channel_id: snowflake, overwrite_id: string): Promise<void>;
347
+ /**
348
+ * Follow a News Channel to send messages to a target channel. Requires the MANAGE_WEBHOOKS permission in the target channel. Returns a followed channel object.
349
+ * @see https://discord.com/developers/docs/resources/channel#follow-news-channel
350
+ */
351
+ followNewsChannel(channel_id: snowflake, params: Channel.Params.Follow): Promise<void>;
352
+ /**
353
+ * Post a typing indicator for the specified channel. Generally bots should not implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message. Returns a 204 empty response on success. Fires a Typing Start Gateway event.
354
+ * @see https://discord.com/developers/docs/resources/channel#trigger-typing-indicator
355
+ */
356
+ triggerTypingIndicator(channel_id: snowflake): Promise<void>;
357
+ /**
358
+ * Adds a recipient to a Group DM using their access token.
359
+ * @see https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
360
+ */
361
+ groupDMAddRecipient(channel_id: snowflake, user_id: snowflake, params: Channel.Params.AddRecipient): Promise<void>;
362
+ /**
363
+ * Removes a recipient from a Group DM.
364
+ * @see https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient
365
+ */
366
+ groupDMRemoveRecipient(channel_id: snowflake, user_id: snowflake): Promise<void>;
246
367
  }
247
368
  }