@satorijs/adapter-discord 4.1.2 → 4.1.4

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 (44) hide show
  1. package/lib/bot.d.ts +2 -2
  2. package/lib/index.js +1 -2
  3. package/lib/index.js.map +1 -2
  4. package/lib/message.d.ts +2 -2
  5. package/lib/utils.d.ts +3 -3
  6. package/lib/ws.d.ts +2 -2
  7. package/package.json +7 -4
  8. package/src/bot.ts +221 -0
  9. package/src/index.ts +27 -0
  10. package/src/message.ts +446 -0
  11. package/src/types/.eslintrc.yml +2 -0
  12. package/src/types/application-role-connection.ts +61 -0
  13. package/src/types/application.ts +120 -0
  14. package/src/types/audit-log.ts +219 -0
  15. package/src/types/auto-moderation.ts +189 -0
  16. package/src/types/ban.ts +92 -0
  17. package/src/types/channel.ts +501 -0
  18. package/src/types/command.ts +320 -0
  19. package/src/types/component.ts +125 -0
  20. package/src/types/device.ts +44 -0
  21. package/src/types/emoji.ts +96 -0
  22. package/src/types/gateway.ts +334 -0
  23. package/src/types/guild-member.ts +260 -0
  24. package/src/types/guild-template.ts +109 -0
  25. package/src/types/guild.ts +476 -0
  26. package/src/types/index.ts +49 -0
  27. package/src/types/integration.ts +130 -0
  28. package/src/types/interaction.ts +283 -0
  29. package/src/types/internal.ts +44 -0
  30. package/src/types/invite.ts +192 -0
  31. package/src/types/message.ts +470 -0
  32. package/src/types/presence.ts +163 -0
  33. package/src/types/reaction.ts +139 -0
  34. package/src/types/role.ts +252 -0
  35. package/src/types/scheduled-event.ts +200 -0
  36. package/src/types/stage-instance.ts +98 -0
  37. package/src/types/sticker.ts +179 -0
  38. package/src/types/team.ts +33 -0
  39. package/src/types/thread.ts +298 -0
  40. package/src/types/user.ts +154 -0
  41. package/src/types/voice.ts +124 -0
  42. package/src/types/webhook.ts +246 -0
  43. package/src/utils.ts +391 -0
  44. package/src/ws.ts +124 -0
@@ -0,0 +1,139 @@
1
+ import { Emoji, GuildMember, integer, Internal, snowflake, User } from '.'
2
+
3
+ /** https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure */
4
+ export interface Reaction {
5
+ /** times this emoji has been used to react */
6
+ count: integer
7
+ /** whether the current user reacted using this emoji */
8
+ me: boolean
9
+ /** emoji information */
10
+ emoji: Partial<Emoji>
11
+ }
12
+
13
+ export namespace Reaction {
14
+ export namespace Event {
15
+ /** https://discord.com/developers/docs/topics/gateway-events#message-reaction-add-message-reaction-add-event-fields */
16
+ export interface Add {
17
+ /** the id of the user */
18
+ user_id: snowflake
19
+ /** the id of the channel */
20
+ channel_id: snowflake
21
+ /** the id of the message */
22
+ message_id: snowflake
23
+ /** the id of the guild */
24
+ guild_id?: snowflake
25
+ /** the member who reacted if this happened in a guild */
26
+ member?: GuildMember
27
+ /** the emoji used to react - example */
28
+ emoji: Partial<Emoji>
29
+ }
30
+
31
+ /** https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-message-reaction-remove-event-fields */
32
+ export interface Remove {
33
+ /** the id of the user */
34
+ user_id: snowflake
35
+ /** the id of the channel */
36
+ channel_id: snowflake
37
+ /** the id of the message */
38
+ message_id: snowflake
39
+ /** the id of the guild */
40
+ guild_id?: snowflake
41
+ /** the emoji used to react - example */
42
+ emoji: Partial<Emoji>
43
+ }
44
+
45
+ /** https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-all-message-reaction-remove-all-event-fields */
46
+ export interface RemoveAll {
47
+ /** the id of the channel */
48
+ channel_id: snowflake
49
+ /** the id of the message */
50
+ message_id: snowflake
51
+ /** the id of the guild */
52
+ guild_id?: snowflake
53
+ }
54
+
55
+ /** https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-emoji-message-reaction-remove-emoji */
56
+ export interface RemoveEmoji {
57
+ /** the id of the channel */
58
+ channel_id: snowflake
59
+ /** the id of the guild */
60
+ guild_id?: snowflake
61
+ /** the id of the message */
62
+ message_id: snowflake
63
+ /** the emoji that was removed */
64
+ emoji: Partial<Emoji>
65
+ }
66
+ }
67
+
68
+ export interface GetParams {
69
+ /** get users after this user ID */
70
+ after?: snowflake
71
+ /** max number of users to return (1-100) */
72
+ limit?: integer
73
+ }
74
+ }
75
+
76
+ declare module './gateway' {
77
+ interface GatewayEvents {
78
+ /** user reacted to a message */
79
+ MESSAGE_REACTION_ADD: Reaction.Event.Add
80
+ /** user removed a reaction from a message */
81
+ MESSAGE_REACTION_REMOVE: Reaction.Event.Remove
82
+ /** all reactions were explicitly removed from a message */
83
+ MESSAGE_REACTION_REMOVE_ALL: Reaction.Event.RemoveAll
84
+ /** all reactions for a given emoji were explicitly removed from a message */
85
+ MESSAGE_REACTION_REMOVE_EMOJI: Reaction.Event.RemoveEmoji
86
+ }
87
+ }
88
+
89
+ declare module './internal' {
90
+ interface Internal {
91
+ /**
92
+ * Create a reaction for the message. This endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the 'ADD_REACTIONS' permission to be present on the current user. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
93
+ * @see https://discord.com/developers/docs/resources/channel#create-reaction
94
+ */
95
+ createReaction(channel_id: snowflake, message_id: snowflake, emoji: string): Promise<void>
96
+ /**
97
+ * Delete a reaction the current user has made for the message. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
98
+ * @see https://discord.com/developers/docs/resources/channel#delete-own-reaction
99
+ */
100
+ deleteOwnReaction(channel_id: snowflake, message_id: snowflake, emoji: string): Promise<void>
101
+ /**
102
+ * Deletes another user's reaction. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
103
+ * @see https://discord.com/developers/docs/resources/channel#delete-user-reaction
104
+ */
105
+ deleteUserReaction(channel_id: snowflake, message_id: snowflake, emoji: string, user_id: snowflake): Promise<void>
106
+ /**
107
+ * Get a list of users that reacted with this emoji. Returns an array of user objects on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
108
+ * @see https://discord.com/developers/docs/resources/channel#get-reactions
109
+ */
110
+ getReactions(channel_id: snowflake, message_id: snowflake, emoji: string, params?: Reaction.GetParams): Promise<User[]>
111
+ /**
112
+ * Deletes all reactions on a message. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Fires a Message Reaction Remove All Gateway event.
113
+ * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions
114
+ */
115
+ deleteAllReactions(channel_id: snowflake, message_id: snowflake): Promise<void>
116
+ /**
117
+ * Deletes all the reactions for a given emoji on a message. This endpoint requires the MANAGE_MESSAGES permission to be present on the current user. Fires a Message Reaction Remove Emoji Gateway event. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
118
+ * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji
119
+ */
120
+ deleteAllReactionsForEmoji(channel_id: snowflake, message_id: snowflake, emoji: string): Promise<void>
121
+ }
122
+ }
123
+
124
+ Internal.define({
125
+ '/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me': {
126
+ PUT: 'createReaction',
127
+ DELETE: 'deleteOwnReaction',
128
+ },
129
+ '/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}': {
130
+ DELETE: 'deleteUserReaction',
131
+ },
132
+ '/channels/{channel.id}/messages/{message.id}/reactions/{emoji}': {
133
+ GET: 'getReactions',
134
+ DELETE: 'deleteAllReactionsforEmoji',
135
+ },
136
+ '/channels/{channel.id}/messages/{message.id}/reactions': {
137
+ DELETE: 'deleteAllReactions',
138
+ },
139
+ })
@@ -0,0 +1,252 @@
1
+ import { integer, Internal, snowflake } from '.'
2
+
3
+ /** https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags */
4
+ export enum Permission {
5
+ /** Allows creation of instant invites */
6
+ CREATE_INSTANT_INVITE = 1 << 0,
7
+ /** Allows kicking members */
8
+ KICK_MEMBERS = 1 << 1,
9
+ /** Allows banning members */
10
+ BAN_MEMBERS = 1 << 2,
11
+ /** Allows all permissions and bypasses channel permission overwrites */
12
+ ADMINISTRATOR = 1 << 3,
13
+ /** Allows management and editing of channels */
14
+ MANAGE_CHANNELS = 1 << 4,
15
+ /** Allows management and editing of the guild */
16
+ MANAGE_GUILD = 1 << 5,
17
+ /** Allows for the addition of reactions to messages */
18
+ ADD_REACTIONS = 1 << 6,
19
+ /** Allows for viewing of audit logs */
20
+ VIEW_AUDIT_LOG = 1 << 7,
21
+ /** Allows for using priority speaker in a voice channel */
22
+ PRIORITY_SPEAKER = 1 << 8,
23
+ /** Allows the user to go live */
24
+ STREAM = 1 << 9,
25
+ /** Allows guild members to view a channel, which includes reading messages in text channels */
26
+ VIEW_CHANNEL = 1 << 10,
27
+ /** Allows for sending messages in a channel (does not allow sending messages in threads) */
28
+ SEND_MESSAGES = 1 << 11,
29
+ /** Allows for sending of /tts messages */
30
+ SEND_TTS_MESSAGES = 1 << 12,
31
+ /** Allows for deletion of other users messages */
32
+ MANAGE_MESSAGES = 1 << 13,
33
+ /** Links sent by users with this permission will be auto-embedded */
34
+ EMBED_LINKS = 1 << 14,
35
+ /** Allows for uploading images and files */
36
+ ATTACH_FILES = 1 << 15,
37
+ /** Allows for reading of message history */
38
+ READ_MESSAGE_HISTORY = 1 << 16,
39
+ /** Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel */
40
+ MENTION_EVERYONE = 1 << 17,
41
+ /** Allows the usage of custom emojis from other servers */
42
+ USE_EXTERNAL_EMOJIS = 1 << 18,
43
+ /** Allows for viewing guild insights */
44
+ VIEW_GUILD_INSIGHTS = 1 << 19,
45
+ /** Allows for joining of a voice channel */
46
+ CONNECT = 1 << 20,
47
+ /** Allows for speaking in a voice channel */
48
+ SPEAK = 1 << 21,
49
+ /** Allows for muting members in a voice channel */
50
+ MUTE_MEMBERS = 1 << 22,
51
+ /** Allows for deafening of members in a voice channel */
52
+ DEAFEN_MEMBERS = 1 << 23,
53
+ /** Allows for moving of members between voice channels */
54
+ MOVE_MEMBERS = 1 << 24,
55
+ /** Allows for using voice-activity-detection in a voice channel */
56
+ USE_VAD = 1 << 25,
57
+ /** Allows for modification of own nickname */
58
+ CHANGE_NICKNAME = 1 << 26,
59
+ /** Allows for modification of other users nicknames */
60
+ MANAGE_NICKNAMES = 1 << 27,
61
+ /** Allows management and editing of roles */
62
+ MANAGE_ROLES = 1 << 28,
63
+ /** Allows management and editing of webhooks */
64
+ MANAGE_WEBHOOKS = 1 << 29,
65
+ /** Allows management and editing of emojis and stickers */
66
+ MANAGE_EMOJIS_AND_STICKERS = 1 << 30,
67
+ /** Allows members to use application commands, including slash commands and context menu commands. */
68
+ USE_APPLICATION_COMMANDS = 1 << 31,
69
+ /** Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.) */
70
+ REQUEST_TO_SPEAK = 1 << 32,
71
+ /** Allows for deleting and archiving threads, and viewing all private threads */
72
+ MANAGE_THREADS = 1 << 34,
73
+ /** Allows for creating threads */
74
+ CREATE_PUBLIC_THREADS = 1 << 35,
75
+ /** Allows for creating private threads */
76
+ CREATE_PRIVATE_THREADS = 1 << 36,
77
+ /** Allows the usage of custom stickers from other servers */
78
+ USE_EXTERNAL_STICKERS = 1 << 37,
79
+ /** Allows for sending messages in threads */
80
+ SEND_MESSAGES_IN_THREADS = 1 << 38,
81
+ /** Allows for launching activities (applications with the EMBEDDED flag) in a voice channel */
82
+ START_EMBEDDED_ACTIVITIES = 1 << 39,
83
+ /** Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels */
84
+ MODERATE_MEMBERS = 1 << 40,
85
+ }
86
+
87
+ /** https://discord.com/developers/docs/topics/permissions#role-object-role-structure */
88
+ export interface Role {
89
+ /** role id */
90
+ id: snowflake
91
+ /** role name */
92
+ name: string
93
+ /** integer representation of hexadecimal color code */
94
+ color: integer
95
+ /** if this role is pinned in the user listing */
96
+ hoist: boolean
97
+ /** role icon hash */
98
+ icon?: string
99
+ /** role unicode emoji */
100
+ unicode_emoji?: string
101
+ /** position of this role */
102
+ position: integer
103
+ /** permission bit set */
104
+ permissions: string
105
+ /** whether this role is managed by an integration */
106
+ managed: boolean
107
+ /** whether this role is mentionable */
108
+ mentionable: boolean
109
+ /** the tags this role has */
110
+ tags?: RoleTags
111
+ }
112
+
113
+ export namespace Role {
114
+ export namespace Params {
115
+ /** https://discord.com/developers/docs/resources/guild#create-guild-role-json-params */
116
+ export interface Create {
117
+ /** name of the role */
118
+ name?: string
119
+ /** bitwise value of the enabled/disabled permissions */
120
+ permissions?: string
121
+ /** RGB color value */
122
+ color?: integer
123
+ /** whether the role should be displayed separately in the sidebar */
124
+ hoist?: boolean
125
+ /** the role's icon image (if the guild has the ROLE_ICONS feature) */
126
+ icon?: string
127
+ /** the role's unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature) */
128
+ unicode_emoji?: string
129
+ /** whether the role should be mentionable */
130
+ mentionable?: boolean
131
+ }
132
+
133
+ /** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions-json-params */
134
+ export interface ModifyPositions {
135
+ /** role */
136
+ id: snowflake
137
+ /** sorting position of the role */
138
+ position?: integer
139
+ }
140
+
141
+ /** https://discord.com/developers/docs/resources/guild#modify-guild-role-json-params */
142
+ export interface Modify {
143
+ /** name of the role */
144
+ name?: string
145
+ /** bitwise value of the enabled/disabled permissions */
146
+ permissions?: string
147
+ /** RGB color value */
148
+ color?: integer
149
+ /** whether the role should be displayed separately in the sidebar */
150
+ hoist?: boolean
151
+ /** the role's icon image (if the guild has the ROLE_ICONS feature) */
152
+ icon?: string
153
+ /** the role's unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature) */
154
+ unicode_emoji?: string
155
+ /** whether the role should be mentionable */
156
+ mentionable?: boolean
157
+ }
158
+ }
159
+ }
160
+
161
+ /** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */
162
+ export interface RoleTags {
163
+ /** the id of the bot this role belongs to */
164
+ bot_id?: snowflake
165
+ /** the id of the integration this role belongs to */
166
+ integration_id?: snowflake
167
+ /** whether this is the guild's premium subscriber role */
168
+ premium_subscriber?: null
169
+ /** the id of this role's subscription sku and listing */
170
+ subscription_listing_id?: snowflake
171
+ /** whether this role is available for purchase */
172
+ available_for_purchase?: null
173
+ /** whether this role is a guild's linked role */
174
+ guild_connections?: null
175
+ }
176
+
177
+ /** https://discord.com/developers/docs/topics/gateway-events#guild-role-create-guild-role-create-event-fields */
178
+ export interface GuildRoleCreateEvent {
179
+ /** the id of the guild */
180
+ guild_id: snowflake
181
+ /** the role created */
182
+ role: Role
183
+ }
184
+
185
+ /** https://discord.com/developers/docs/topics/gateway-events#guild-role-update-guild-role-update-event-fields */
186
+ export interface GuildRoleUpdateEvent {
187
+ /** the id of the guild */
188
+ guild_id: snowflake
189
+ /** the role updated */
190
+ role: Role
191
+ }
192
+
193
+ /** https://discord.com/developers/docs/topics/gateway-events#guild-role-delete-guild-role-delete-event-fields */
194
+ export interface GuildRoleDeleteEvent {
195
+ /** id of the guild */
196
+ guild_id: snowflake
197
+ /** id of the role */
198
+ role_id: snowflake
199
+ }
200
+
201
+ declare module './gateway' {
202
+ interface GatewayEvents {
203
+ /** guild role was created */
204
+ GUILD_ROLE_CREATE: GuildRoleCreateEvent
205
+ /** guild role was updated */
206
+ GUILD_ROLE_UPDATE: GuildRoleUpdateEvent
207
+ /** guild role was deleted */
208
+ GUILD_ROLE_DELETE: GuildRoleDeleteEvent
209
+ }
210
+ }
211
+
212
+ declare module './internal' {
213
+ interface Internal {
214
+ /**
215
+ * Returns a list of role objects for the guild.
216
+ * @see https://discord.com/developers/docs/resources/guild#get-guild-roles
217
+ */
218
+ getGuildRoles(guild_id: snowflake): Promise<Role[]>
219
+ /**
220
+ * Create a new role for the guild. Requires the MANAGE_ROLES permission. Returns the new role object on success. Fires a Guild Role Create Gateway event. All JSON params are optional.
221
+ * @see https://discord.com/developers/docs/resources/guild#create-guild-role
222
+ */
223
+ createGuildRole(guild_id: snowflake, param: Role.Params.Create): Promise<Role>
224
+ /**
225
+ * Modify the positions of a set of role objects for the guild. Requires the MANAGE_ROLES permission. Returns a list of all of the guild's role objects on success. Fires multiple Guild Role Update Gateway events.
226
+ * @see https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
227
+ */
228
+ modifyGuildRolePositions(guild_id: snowflake, param: Role.Params.ModifyPositions): Promise<Role[]>
229
+ /**
230
+ * Modify a guild role. Requires the MANAGE_ROLES permission. Returns the updated role on success. Fires a Guild Role Update Gateway event.
231
+ * @see https://discord.com/developers/docs/resources/guild#modify-guild-role
232
+ */
233
+ modifyGuildRole(guild_id: snowflake, role_id: snowflake, param: Role.Params.Modify): Promise<Role>
234
+ /**
235
+ * Delete a guild role. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. Fires a Guild Role Delete Gateway event.
236
+ * @see https://discord.com/developers/docs/resources/guild#delete-guild-role
237
+ */
238
+ deleteGuildRole(guild_id: snowflake, role_id: snowflake): Promise<void>
239
+ }
240
+ }
241
+
242
+ Internal.define({
243
+ '/guilds/{guild.id}/roles': {
244
+ GET: 'getGuildRoles',
245
+ POST: 'createGuildRole',
246
+ PATCH: 'modifyGuildRolePositions',
247
+ },
248
+ '/guilds/{guild.id}/roles/{role.id}': {
249
+ PATCH: 'modifyGuildRole',
250
+ DELETE: 'deleteGuildRole',
251
+ },
252
+ })
@@ -0,0 +1,200 @@
1
+ import { GuildMember, integer, Internal, snowflake, timestamp, User } from '.'
2
+
3
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-structure */
4
+ export interface GuildScheduledEvent {
5
+ /** the id of the scheduled event */
6
+ id: snowflake
7
+ /** the guild id which the scheduled event belongs to */
8
+ guild_id: snowflake
9
+ /** the channel id in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL */
10
+ channel_id?: snowflake
11
+ /** the id of the user that created the scheduled event * */
12
+ creator_id?: snowflake
13
+ /** the name of the scheduled event (1-100 characters) */
14
+ name: string
15
+ /** the description of the scheduled event (1-1000 characters) */
16
+ description?: string
17
+ /** the time the scheduled event will start */
18
+ scheduled_start_time: timestamp
19
+ /** the time the scheduled event will end, required if entity_type is EXTERNAL */
20
+ scheduled_end_time?: timestamp
21
+ /** the privacy level of the scheduled event */
22
+ privacy_level: GuildScheduledEvent.PrivacyLevel
23
+ /** the status of the scheduled event */
24
+ status: GuildScheduledEvent.Status
25
+ /** the type of the scheduled event */
26
+ entity_type: GuildScheduledEvent.EntityType
27
+ /** the id of an entity associated with a guild scheduled event */
28
+ entity_id?: snowflake
29
+ /** additional metadata for the guild scheduled event */
30
+ entity_metadata?: GuildScheduledEvent.EntityMetadata
31
+ /** the user that created the scheduled event */
32
+ creator?: User
33
+ /** the number of users subscribed to the scheduled event */
34
+ user_count?: integer
35
+ /** the cover image hash of the scheduled event */
36
+ image?: string
37
+ }
38
+
39
+ export namespace GuildScheduledEvent {
40
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level */
41
+ export enum PrivacyLevel {
42
+ /** the scheduled event is only accessible to guild members */
43
+ GUILD_ONLY = 2,
44
+ }
45
+
46
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types */
47
+ export enum EntityType {
48
+ STAGE_INSTANCE = 1,
49
+ VOICE = 2,
50
+ EXTERNAL = 3,
51
+ }
52
+
53
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status */
54
+ export enum Status {
55
+ SCHEDULED = 1,
56
+ ACTIVE = 2,
57
+ COMPLETED = 3,
58
+ CANCELLED = 4,
59
+ }
60
+
61
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata */
62
+ export interface EntityMetadata {
63
+ /** location of the event (1-100 characters) */
64
+ location?: string
65
+ }
66
+
67
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild-query-string-params */
68
+ export interface ListParams {
69
+ /** include number of users subscribed to each event */
70
+ with_user_count?: boolean
71
+ }
72
+
73
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event-json-params */
74
+ export interface CreateParams {
75
+ /** the channel id of the scheduled event. */
76
+ channel_id?: snowflake
77
+ /** the entity metadata of the scheduled event */
78
+ entity_metadata?: EntityMetadata
79
+ /** the name of the scheduled event */
80
+ name: string
81
+ /** the privacy level of the scheduled event */
82
+ privacy_level: PrivacyLevel
83
+ /** the time to schedule the scheduled event */
84
+ scheduled_start_time: timestamp
85
+ /** the time when the scheduled event is scheduled to end */
86
+ scheduled_end_time?: timestamp
87
+ /** the description of the scheduled event */
88
+ description?: string
89
+ /** the entity type of the scheduled event */
90
+ entity_type: EntityType
91
+ /** the cover image of the scheduled event */
92
+ image?: string
93
+ }
94
+
95
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-query-string-params */
96
+ export interface GetParams {
97
+ /** include number of users subscribed to this event */
98
+ with_user_count?: boolean
99
+ }
100
+
101
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event-json-params */
102
+ export interface ModifyParams {
103
+ /** the channel id of the scheduled event, set to null if changing entity type to EXTERNAL */
104
+ channel_id?: snowflake
105
+ /** the entity metadata of the scheduled event */
106
+ entity_metadata?: EntityMetadata
107
+ /** the name of the scheduled event */
108
+ name?: string
109
+ /** the privacy level of the scheduled event */
110
+ privacy_level?: PrivacyLevel
111
+ /** the time to schedule the scheduled event */
112
+ scheduled_start_time?: timestamp
113
+ /** the time when the scheduled event is scheduled to end */
114
+ scheduled_end_time?: timestamp
115
+ /** the description of the scheduled event */
116
+ description?: string
117
+ /** the entity type of the scheduled event */
118
+ entity_type?: EntityType
119
+ /** the status of the scheduled event */
120
+ status?: Status
121
+ /** the cover image of the scheduled event */
122
+ image?: string
123
+ }
124
+ }
125
+
126
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure */
127
+ export interface GuildScheduledEventUser {
128
+ /** the scheduled event id which the user subscribed to */
129
+ guild_scheduled_event_id: snowflake
130
+ /** user which subscribed to an event */
131
+ user: User
132
+ /** guild member data for this user for the guild which this event belongs to, if any */
133
+ member?: GuildMember
134
+ }
135
+
136
+ export namespace GuildScheduledEventUser {
137
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users-query-string-params */
138
+ export interface GetParams {
139
+ /** number of users to return (up to maximum 100) */
140
+ limit?: number
141
+ /** include guild member data if it exists */
142
+ with_member?: boolean
143
+ /** consider only users before given user id */
144
+ before?: snowflake
145
+ /** consider only users after given user id */
146
+ after?: snowflake
147
+ }
148
+ }
149
+
150
+ declare module './internal' {
151
+ interface Internal {
152
+ /**
153
+ * Returns a list of guild scheduled event objects for the given guild.
154
+ * @see https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild
155
+ */
156
+ listScheduledEventsforGuild(guildId: snowflake, params?: GuildScheduledEvent.ListParams): Promise<GuildScheduledEvent[]>
157
+ /**
158
+ * Create a guild scheduled event in the guild. Returns a guild scheduled event object on success.
159
+ * @see https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
160
+ */
161
+ createGuildScheduledEvent(guildId: snowflake, params: GuildScheduledEvent.CreateParams): Promise<GuildScheduledEvent>
162
+ /**
163
+ * Get a guild scheduled event. Returns a guild scheduled event object on success.
164
+ * @see https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
165
+ */
166
+ getGuildScheduledEvent(guildId: snowflake, eventId: snowflake, params?: GuildScheduledEvent.GetParams): Promise<GuildScheduledEvent>
167
+ /**
168
+ * Modify a guild scheduled event. Returns the modified guild scheduled event object on success.
169
+ * @see https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
170
+ */
171
+ modifyGuildScheduledEvent(guildId: snowflake, eventId: snowflake, params: GuildScheduledEvent.ModifyParams): Promise<GuildScheduledEvent>
172
+ /**
173
+ * Delete a guild scheduled event. Returns a 204 on success.
174
+ * @see https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event
175
+ */
176
+ deleteGuildScheduledEvent(guildId: snowflake, eventId: snowflake): Promise<void>
177
+ /**
178
+ * Get a list of guild scheduled event users subscribed to a guild scheduled event.
179
+ * Returns a list of guild scheduled event user objects on success.
180
+ * Guild member data, if it exists, is included if the with_member query parameter is set.
181
+ * @see https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
182
+ */
183
+ getGuildScheduledEventUsers(guildId: snowflake, eventId: snowflake, params?: GuildScheduledEventUser.GetParams): Promise<GuildScheduledEventUser[]>
184
+ }
185
+ }
186
+
187
+ Internal.define({
188
+ '/guilds/{guild.id}/scheduled-events': {
189
+ GET: 'listScheduledEventsforGuild',
190
+ POST: 'createGuildScheduledEvent',
191
+ },
192
+ '/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}': {
193
+ GET: 'getGuildScheduledEvent',
194
+ PATCH: 'modifyGuildScheduledEvent',
195
+ DELETE: 'deleteGuildScheduledEvent',
196
+ },
197
+ '/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users': {
198
+ GET: 'getGuildScheduledEventUsers',
199
+ },
200
+ })