@satorijs/adapter-discord 3.1.1 → 3.2.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.
@@ -32,50 +32,114 @@ export declare namespace AuditLog {
32
32
  }
33
33
  /** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
34
34
  enum Type {
35
+ /** Server settings were updated */
35
36
  GUILD_UPDATE = 1,
37
+ /** Channel was created */
36
38
  CHANNEL_CREATE = 10,
39
+ /** Channel settings were updated */
37
40
  CHANNEL_UPDATE = 11,
41
+ /** Channel was deleted */
38
42
  CHANNEL_DELETE = 12,
43
+ /** Permission overwrite was added to a channel */
39
44
  CHANNEL_OVERWRITE_CREATE = 13,
45
+ /** Permission overwrite was updated for a channel */
40
46
  CHANNEL_OVERWRITE_UPDATE = 14,
47
+ /** Permission overwrite was deleted from a channel */
41
48
  CHANNEL_OVERWRITE_DELETE = 15,
49
+ /** Member was removed from server */
42
50
  MEMBER_KICK = 20,
51
+ /** Members were pruned from server */
43
52
  MEMBER_PRUNE = 21,
53
+ /** Member was banned from server */
44
54
  MEMBER_BAN_ADD = 22,
55
+ /** Server ban was lifted for a member */
45
56
  MEMBER_BAN_REMOVE = 23,
57
+ /** Member was updated in server */
46
58
  MEMBER_UPDATE = 24,
59
+ /** Member was added or removed from a role */
47
60
  MEMBER_ROLE_UPDATE = 25,
61
+ /** Member was moved to a different voice channel */
48
62
  MEMBER_MOVE = 26,
63
+ /** Member was disconnected from a voice channel */
49
64
  MEMBER_DISCONNECT = 27,
65
+ /** Bot user was added to server */
50
66
  BOT_ADD = 28,
67
+ /** Role was created */
51
68
  ROLE_CREATE = 30,
69
+ /** Role was edited */
52
70
  ROLE_UPDATE = 31,
71
+ /** Role was deleted */
53
72
  ROLE_DELETE = 32,
73
+ /** Server invite was created */
54
74
  INVITE_CREATE = 40,
75
+ /** Server invite was updated */
55
76
  INVITE_UPDATE = 41,
77
+ /** Server invite was deleted */
56
78
  INVITE_DELETE = 42,
79
+ /** Webhook was created */
57
80
  WEBHOOK_CREATE = 50,
81
+ /** Webhook properties or channel were updated */
58
82
  WEBHOOK_UPDATE = 51,
83
+ /** Webhook was deleted */
59
84
  WEBHOOK_DELETE = 52,
85
+ /** Emoji was created */
60
86
  EMOJI_CREATE = 60,
87
+ /** Emoji name was updated */
61
88
  EMOJI_UPDATE = 61,
89
+ /** Emoji was deleted */
62
90
  EMOJI_DELETE = 62,
91
+ /** Single message was deleted */
63
92
  MESSAGE_DELETE = 72,
93
+ /** Multiple messages were deleted */
64
94
  MESSAGE_BULK_DELETE = 73,
95
+ /** Message was pinned to a channel */
65
96
  MESSAGE_PIN = 74,
97
+ /** Message was unpinned from a channel */
66
98
  MESSAGE_UNPIN = 75,
99
+ /** App was added to server */
67
100
  INTEGRATION_CREATE = 80,
101
+ /** App was updated (as an example, its scopes were updated) */
68
102
  INTEGRATION_UPDATE = 81,
103
+ /** App was removed from server */
69
104
  INTEGRATION_DELETE = 82,
105
+ /** Stage instance was created (stage channel becomes live) */
70
106
  STAGE_INSTANCE_CREATE = 83,
107
+ /** Stage instance details were updated */
71
108
  STAGE_INSTANCE_UPDATE = 84,
109
+ /** Stage instance was deleted (stage channel no longer live) */
72
110
  STAGE_INSTANCE_DELETE = 85,
111
+ /** Sticker was created */
73
112
  STICKER_CREATE = 90,
113
+ /** Sticker details were updated */
74
114
  STICKER_UPDATE = 91,
115
+ /** Sticker was deleted */
75
116
  STICKER_DELETE = 92,
117
+ /** Event was created */
118
+ GUILD_SCHEDULED_EVENT_CREATE = 100,
119
+ /** Event was updated */
120
+ GUILD_SCHEDULED_EVENT_UPDATE = 101,
121
+ /** Event was cancelled */
122
+ GUILD_SCHEDULED_EVENT_DELETE = 102,
123
+ /** Thread was created in a channel */
76
124
  THREAD_CREATE = 110,
125
+ /** Thread was updated */
77
126
  THREAD_UPDATE = 111,
78
- THREAD_DELETE = 112
127
+ /** Thread was deleted */
128
+ THREAD_DELETE = 112,
129
+ /** Permissions were updated for a command */
130
+ APPLICATION_COMMAND_PERMISSION_UPDATE = 121,
131
+ /** Auto Moderation rule was created */
132
+ AUTO_MODERATION_RULE_CREATE = 140,
133
+ /** Auto Moderation rule was updated */
134
+ AUTO_MODERATION_RULE_UPDATE = 141,
135
+ /** Auto Moderation rule was deleted */
136
+ AUTO_MODERATION_RULE_DELETE = 142,
137
+ /** Message was blocked by AutoMod */
138
+ AUTO_MODERATION_BLOCK_MESSAGE = 143,
139
+ /** Message was flagged by AutoMod */
140
+ AUTO_MODERATION_FLAG_TO_CHANNEL = 144,
141
+ /** Member was timed out by AutoMod */
142
+ AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145
79
143
  }
80
144
  /** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
81
145
  interface OptionalInfo {
@@ -0,0 +1,165 @@
1
+ import { integer, snowflake } from '.';
2
+ /** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure */
3
+ export interface AutoModerationRule {
4
+ /** the id of this rule */
5
+ id: snowflake;
6
+ /** the id of the guild which this rule belongs to */
7
+ guild_id: snowflake;
8
+ /** the rule name */
9
+ name: string;
10
+ /** the user which first created this rule */
11
+ creator_id: snowflake;
12
+ /** the rule event type */
13
+ event_type: AutoModerationRule.EventType;
14
+ /** the rule trigger type */
15
+ trigger_type: AutoModerationRule.TriggerType;
16
+ /** the rule trigger metadata */
17
+ trigger_metadata: AutoModerationRule.TriggerMetadata;
18
+ /** the actions which will execute when the rule is triggered */
19
+ actions: AutoModerationAction[];
20
+ /** whether the rule is enabled */
21
+ enabled: boolean;
22
+ /** the role ids that should not be affected by the rule (Maximum of 20) */
23
+ exempt_roles: snowflake[];
24
+ /** the channel ids that should not be affected by the rule (Maximum of 50) */
25
+ exempt_channels: snowflake[];
26
+ }
27
+ export declare namespace AutoModerationRule {
28
+ /**
29
+ * Indicates in what event context a rule should be checked.
30
+ * @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
31
+ */
32
+ const enum EventType {
33
+ /** when a member sends or edits a message in the guild */
34
+ MESSAGE_SEND = 1
35
+ }
36
+ /**
37
+ * Characterizes the type of content which can trigger the rule.
38
+ * @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types
39
+ */
40
+ const enum TriggerType {
41
+ /** check if content contains words from a user defined list of keywords (max per guild: 3) */
42
+ KEYWORD = 1,
43
+ /** check if content represents generic spam (max per guild: 1) */
44
+ SPAM = 3,
45
+ /** check if content contains words from internal pre-defined wordsets (max per guild: 1) */
46
+ KEYWORD_PRESET = 4,
47
+ /** check if content contains more unique mentions than allowed (max per guild: 1) */
48
+ MENTION_SPAM = 5
49
+ }
50
+ /**
51
+ * Additional data used to determine whether a rule should be triggered.
52
+ * Different fields are relevant based on the value of trigger_type.
53
+ * @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata
54
+ */
55
+ interface TriggerMetadata {
56
+ /** associated with `KEYWORD`: substrings which will be searched for in content */
57
+ keyword_filter: string[];
58
+ /** associated with `KEYWORD_PRESET`: the internally pre-defined wordsets which will be searched for in content */
59
+ presets: KeywordPresetType[];
60
+ /** associated with `KEYWORD_PRESET`: substrings which will be exempt from triggering the preset trigger type */
61
+ allow_list: string[];
62
+ /** associated with `MENTION_SPAM`: total number of unique role and user mentions allowed per message (Maximum of 50) */
63
+ mention_total_limit: integer;
64
+ }
65
+ /** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types */
66
+ const enum KeywordPresetType {
67
+ /** Words that may be considered forms of swearing or cursing */
68
+ PROFANITY = 1,
69
+ /** Words that refer to sexually explicit behavior or activity */
70
+ SEXUAL_CONTEN = 2,
71
+ /** Personal insults or words that may be considered hate speech */
72
+ SLURS = 3
73
+ }
74
+ /** @see https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule-json-params */
75
+ interface CreateParams {
76
+ /** the rule name */
77
+ name: string;
78
+ /** the event type */
79
+ event_type: EventType;
80
+ /** the trigger type */
81
+ trigger_type: TriggerType;
82
+ /** the trigger metadata */
83
+ trigger_metadata?: TriggerMetadata;
84
+ /** the actions which will execute when the rule is triggered */
85
+ actions: AutoModerationAction[];
86
+ /** whether the rule is enabled (False by default) */
87
+ enabled?: boolean;
88
+ /** the role ids that should not be affected by the rule (Maximum of 20) */
89
+ exempt_roles?: snowflake[];
90
+ /** the channel ids that should not be affected by the rule (Maximum of 50) */
91
+ exempt_channels?: snowflake[];
92
+ }
93
+ }
94
+ /** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure */
95
+ export interface AutoModerationAction {
96
+ /** the type of action */
97
+ type: AutoModerationAction.Type;
98
+ /** additional metadata needed during execution for this specific action type */
99
+ metadata?: AutoModerationAction.Metadata;
100
+ }
101
+ export declare namespace AutoModerationAction {
102
+ /** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types */
103
+ const enum Type {
104
+ /** blocks the content of a message according to the rule */
105
+ BLOCK_MESSAGE = 1,
106
+ /** logs user content to a specified channel */
107
+ SEND_ALERT_MESSAGE = 2,
108
+ /**
109
+ * timeout user for a specified duration
110
+ *
111
+ * A `TIMEOUT` action can only be set up for `KEYWORD` and `MENTION_SPAM` rules.
112
+ * The `MODERATE_MEMBERS` permission is required to use the `TIMEOUT` action type.)
113
+ */
114
+ TIMEOUT = 3
115
+ }
116
+ /** @see https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata */
117
+ interface Metadata {
118
+ /**
119
+ * associated with `SEND_ALERT_MESSAGE`:
120
+ * channel to which user content should be logged
121
+ */
122
+ channel_id?: snowflake;
123
+ /**
124
+ * associated with `TIMEOUT`:
125
+ * timeout duration in seconds, maximum of 2419200 seconds (4 weeks)
126
+ */
127
+ duration_seconds?: integer;
128
+ }
129
+ }
130
+ declare module './internal' {
131
+ interface Internal {
132
+ /**
133
+ * Get a list of all rules currently configured for the guild.
134
+ * Returns a list of auto moderation rule objects for the given guild.
135
+ * This endpoint requires the `MANAGE_GUILD` permission.
136
+ * @see https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
137
+ */
138
+ listAutoModerationRules(guildId: snowflake): Promise<AutoModerationRule[]>;
139
+ /**
140
+ * Get a single rule. Returns an auto moderation rule object.
141
+ * This endpoint requires the `MANAGE_GUILD` permission.
142
+ * @see https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
143
+ */
144
+ getAutoModerationRule(guildId: snowflake, ruleId: snowflake): Promise<AutoModerationRule>;
145
+ /**
146
+ * Create a new rule. Returns an auto moderation rule on success. Fires an Auto Moderation Rule Create Gateway event.
147
+ * This endpoint requires the `MANAGE_GUILD` permission.
148
+ * @see https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
149
+ */
150
+ createAutoModerationRule(guildId: snowflake, data: AutoModerationRule.CreateParams): Promise<AutoModerationRule>;
151
+ /**
152
+ * Modify an existing rule. Returns an auto moderation rule on success.
153
+ * Fires an Auto Moderation Rule Update Gateway event.
154
+ * This endpoint requires the `MANAGE_GUILD` permission.
155
+ * @see https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
156
+ */
157
+ modifyAutoModerationRule(guildId: snowflake, ruleId: snowflake, data: Partial<AutoModerationRule.CreateParams>): Promise<AutoModerationRule>;
158
+ /**
159
+ * Delete a rule. Returns a 204 on success. Fires an Auto Moderation Rule Delete Gateway event.
160
+ * This endpoint requires the `MANAGE_GUILD` permission.
161
+ * @see https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
162
+ */
163
+ deleteAutoModerationRule(guildId: snowflake, ruleId: snowflake): Promise<void>;
164
+ }
165
+ }
@@ -23,14 +23,21 @@ export declare namespace Ban {
23
23
  user: User;
24
24
  }
25
25
  }
26
- namespace Params {
27
- /** https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params */
28
- interface Create {
29
- /** number of days to delete messages for (0-7) */
30
- delete_message_days?: integer;
31
- /** reason for the ban (deprecated) */
32
- reason?: string;
33
- }
26
+ /** @see https://discord.com/developers/docs/resources/guild#get-guild-bans-query-string-params */
27
+ interface GetParams {
28
+ /** number of users to return (up to maximum 1000) */
29
+ limit?: number;
30
+ /** consider only users before given user id */
31
+ before?: snowflake;
32
+ /** consider only users after given user id */
33
+ after?: snowflake;
34
+ }
35
+ /** @see https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params */
36
+ interface CreateParams {
37
+ /** number of days to delete messages for (0-7) */
38
+ delete_message_days?: integer;
39
+ /** reason for the ban (deprecated) */
40
+ reason?: string;
34
41
  }
35
42
  }
36
43
  declare module './gateway' {
@@ -47,7 +54,7 @@ declare module './internal' {
47
54
  * Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission.
48
55
  * @see https://discord.com/developers/docs/resources/guild#get-guild-bans
49
56
  */
50
- getGuildBans(guild_id: snowflake): Promise<Ban[]>;
57
+ getGuildBans(guild_id: snowflake, params: Ban.GetParams): Promise<Ban[]>;
51
58
  /**
52
59
  * Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.
53
60
  * @see https://discord.com/developers/docs/resources/guild#get-guild-ban
@@ -57,7 +64,7 @@ declare module './internal' {
57
64
  * Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BAN_MEMBERS permission. Returns a 204 empty response on success. Fires a Guild Ban Add Gateway event.
58
65
  * @see https://discord.com/developers/docs/resources/guild#create-guild-ban
59
66
  */
60
- createGuildBan(guild_id: snowflake, user_id: snowflake, params: Ban.Params.Create): Promise<void>;
67
+ createGuildBan(guild_id: snowflake, user_id: snowflake, params?: Ban.CreateParams): Promise<void>;
61
68
  /**
62
69
  * Remove the ban for a user. Requires the BAN_MEMBERS permissions. Returns a 204 empty response on success. Fires a Guild Ban Remove Gateway event.
63
70
  * @see https://discord.com/developers/docs/resources/guild#remove-guild-ban
@@ -68,7 +68,11 @@ export declare namespace Channel {
68
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
69
  GUILD_PRIVATE_THREAD = 12,
70
70
  /** a voice channel for hosting events with an audience */
71
- GUILD_STAGE_VOICE = 13
71
+ GUILD_STAGE_VOICE = 13,
72
+ /** the channel in a hub containing the listed servers */
73
+ GUILD_DIRECTORY = 14,
74
+ /** Channel that can only contain threads */
75
+ GUILD_FORUM = 15
72
76
  }
73
77
  namespace Params {
74
78
  /** https://discord.com/developers/docs/resources/user#create-dm-json-params */
@@ -1,4 +1,4 @@
1
- import { Channel, snowflake } from '.';
1
+ import { Channel, Locale, snowflake } from '.';
2
2
  /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure */
3
3
  export interface ApplicationCommand {
4
4
  /** unique id of the command */
@@ -9,12 +9,20 @@ export interface ApplicationCommand {
9
9
  application_id: snowflake;
10
10
  /** guild id of the command, if not global */
11
11
  guild_id?: snowflake;
12
- /** 1-32 character name */
12
+ /** Name of command, 1-32 characters */
13
13
  name: string;
14
- /** 1-100 character description for CHAT_INPUT commands, empty string for USER and MESSAGE commands */
14
+ /** Localization dictionary for name field. Values follow the same restrictions as name */
15
+ name_localizations?: Record<Locale, string>;
16
+ /** Description for `CHAT_INPUT` commands, 1-100 characters. Empty string for `USER` and `MESSAGE` commands */
15
17
  description: string;
18
+ /** Localization dictionary for description field. Values follow the same restrictions as description */
19
+ description_localizations?: Record<Locale, string>;
16
20
  /** the parameters for the command, max 25 */
17
21
  options?: ApplicationCommand.Option[];
22
+ /** Set of permissions represented as a bit set */
23
+ default_member_permissions?: string;
24
+ /** Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. */
25
+ dm_permission?: boolean;
18
26
  /** whether the command is enabled by default when the app is added to a guild */
19
27
  default_permission?: boolean;
20
28
  /** autoincrementing version identifier updated during substantial record changes */
@@ -84,7 +92,12 @@ export declare namespace ApplicationCommand {
84
92
  }
85
93
  /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure */
86
94
  interface Permissions {
87
- /** the id of the role or user */
95
+ /**
96
+ * ID of the role, user, or channel.
97
+ * It can also be a [permission constant](https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants):
98
+ * - `guild_id`: All members in a guild
99
+ * - `guild_id - 1`: All channels in a guild
100
+ */
88
101
  id: snowflake;
89
102
  /** role or user */
90
103
  type: PermissionType;
@@ -94,7 +107,8 @@ export declare namespace ApplicationCommand {
94
107
  /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type */
95
108
  enum PermissionType {
96
109
  ROLE = 1,
97
- USER = 2
110
+ USER = 2,
111
+ CHANNEL = 3
98
112
  }
99
113
  namespace Params {
100
114
  /** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command-json-params */
@@ -128,6 +142,15 @@ export declare namespace ApplicationCommand {
128
142
  }
129
143
  }
130
144
  }
145
+ declare module './gateway' {
146
+ interface GatewayEvents {
147
+ /**
148
+ * sent when an application command's permissions are updated
149
+ * @see https://discord.com/developers/docs/topics/gateway-events#application-command-permissions-update
150
+ */
151
+ APPLICATION_COMMAND_PERMISSIONS_UPDATE: ApplicationCommand.GuildPermissions;
152
+ }
153
+ }
131
154
  declare module './internal' {
132
155
  interface Internal {
133
156
  /**
@@ -180,11 +203,6 @@ declare module './internal' {
180
203
  * @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
181
204
  */
182
205
  getGuildApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake): Promise<ApplicationCommand.GuildPermissions[]>;
183
- /**
184
- * This endpoint will overwrite all existing permissions for all commands in a guild, including slash commands, user commands, and message commands.
185
- * @see https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
186
- */
187
- batchEditApplicationCommandPermissions(application_id: snowflake, guild_id: snowflake, permissions: Partial<ApplicationCommand.GuildPermissions>[]): Promise<void>;
188
206
  /**
189
207
  * Fetch a guild command for your application. Returns an application command object.
190
208
  * @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command
@@ -2,7 +2,7 @@ import { Emoji, integer } from '.';
2
2
  /** https://discord.com/developers/docs/interactions/message-components#component-object-component-structure */
3
3
  export interface Component {
4
4
  /** component type */
5
- type: integer;
5
+ type: ComponentType;
6
6
  /** a developer-defined identifier for the component, max 100 characters */
7
7
  custom_id?: string;
8
8
  /** whether the component is disabled, default false */
@@ -33,12 +33,14 @@ export declare enum ComponentType {
33
33
  /** A button object */
34
34
  BUTTON = 2,
35
35
  /** A select menu for picking from choices */
36
- SELECT_MENU = 3
36
+ SELECT_MENU = 3,
37
+ /** A text input object */
38
+ TEXT_INPUT = 4
37
39
  }
38
40
  /** https://discord.com/developers/docs/interactions/message-components#button-object-button-structure */
39
41
  export interface Button {
40
42
  /** 2 for a button */
41
- type: integer;
43
+ type: ComponentType.BUTTON;
42
44
  /** one of button styles */
43
45
  style: integer;
44
46
  /** text that appears on the button, max 80 characters */
@@ -55,7 +57,7 @@ export interface Button {
55
57
  /** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure */
56
58
  export interface SelectMenu {
57
59
  /** 3 for a select menu */
58
- type: integer;
60
+ type: ComponentType.SELECT_MENU;
59
61
  /** a developer-defined identifier for the button, max 100 characters */
60
62
  custom_id: string;
61
63
  /** the choices in the select, max 25 */
@@ -82,3 +84,31 @@ export interface SelectOption {
82
84
  /** will render this option as selected by default */
83
85
  default?: boolean;
84
86
  }
87
+ /** @see https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure */
88
+ export interface TextInput {
89
+ /** 4 for a text input */
90
+ type: ComponentType.TEXT_INPUT;
91
+ /** a developer-defined identifier for the input, max 100 characters */
92
+ custom_id: string;
93
+ /** the Text Input Style */
94
+ style: TextInputStyles;
95
+ /** the label for this component, max 45 characters */
96
+ label: string;
97
+ /** the minimum input length for a text input, min 0, max 4000 */
98
+ min_length?: integer;
99
+ /** the maximum input length for a text input, min 1, max 4000 */
100
+ max_length?: integer;
101
+ /** whether this component is required to be filled, default true */
102
+ required?: boolean;
103
+ /** a pre-filled value for this component, max 4000 characters */
104
+ value?: string;
105
+ /** custom placeholder text if the input is empty, max 100 characters */
106
+ placeholder?: string;
107
+ }
108
+ /** @see https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles */
109
+ export declare const enum TextInputStyles {
110
+ /** A single-line input */
111
+ SHORT = 1,
112
+ /** A multi-line input */
113
+ PARAGRAPH = 2
114
+ }
@@ -140,7 +140,44 @@ export declare enum GatewayIntent {
140
140
  /**
141
141
  * - TYPING_START
142
142
  */
143
- DIRECT_MESSAGE_TYPING = 16384
143
+ DIRECT_MESSAGE_TYPING = 16384,
144
+ /**
145
+ * `MESSAGE_CONTENT` is a unique privileged intent that isn't directly associated with any Gateway events.
146
+ * Instead, access to `MESSAGE_CONTENT` permits your app to receive message content data across the APIs.
147
+ *
148
+ * Any fields affected by the message content intent are noted in the relevant documentation.
149
+ * For example, the content, embeds, attachments, and components fields in message objects all contain message content and therefore require the intent.
150
+ *
151
+ * Like other privileged intents, `MESSAGE_CONTENT` must be approved for your app.
152
+ * After your app is verified, you can apply for the intent from your app's settings within the Developer Portal.
153
+ * You can read more about the message content intent review policy in the [Help Center](https://support-dev.discord.com/hc/en-us/articles/5324827539479).
154
+ *
155
+ * Apps without the intent will receive empty values in fields that contain user-inputted content with a few exceptions:
156
+ * - Content in messages that an app sends
157
+ * - Content in DMs with the app
158
+ * - Content in which the app is mentioned
159
+ *
160
+ * @see https://discord.com/developers/docs/topics/gateway#message-content-intent
161
+ */
162
+ MESSAGE_CONTENT = 32768,
163
+ /**
164
+ * - GUILD_SCHEDULED_EVENT_CREATE
165
+ * - GUILD_SCHEDULED_EVENT_UPDATE
166
+ * - GUILD_SCHEDULED_EVENT_DELETE
167
+ * - GUILD_SCHEDULED_EVENT_USER_ADD
168
+ * - GUILD_SCHEDULED_EVENT_USER_REMOVE
169
+ */
170
+ GUILD_SCHEDULED_EVENTS = 65536,
171
+ /**
172
+ * - AUTO_MODERATION_RULE_CREATE
173
+ * - AUTO_MODERATION_RULE_UPDATE
174
+ * - AUTO_MODERATION_RULE_DELETE
175
+ */
176
+ AUTO_MODERATION_CONFIGURATION = 131072,
177
+ /**
178
+ * - AUTO_MODERATION_ACTION_EXECUTION
179
+ */
180
+ AUTO_MODERATION_EXECUTION = 262144
144
181
  }
145
182
  export interface GatewayParams {
146
183
  [GatewayOpcode.HELLO]: HelloParams;
@@ -158,7 +195,7 @@ export interface IdentifyParams {
158
195
  /** authentication token */
159
196
  token: string;
160
197
  /** connection properties */
161
- properties: object;
198
+ properties: ConnectionProperties;
162
199
  /** whether this connection supports compression of packets */
163
200
  compress?: boolean;
164
201
  /** value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list */
@@ -170,6 +207,15 @@ export interface IdentifyParams {
170
207
  /** the Gateway Intents you wish to receive */
171
208
  intents: integer;
172
209
  }
210
+ /** https://discord.com/developers/docs/topics/gateway-events#identify-identify-connection-properties */
211
+ export interface ConnectionProperties {
212
+ /** Your operating system */
213
+ os: string;
214
+ /** Your library name */
215
+ browser: string;
216
+ /** Your library name */
217
+ device: string;
218
+ }
173
219
  /** https://discord.com/developers/docs/topics/gateway#resume-resume-structure */
174
220
  export interface ResumeParams {
175
221
  /** session token */
@@ -1,6 +1,7 @@
1
1
  export * from './internal';
2
2
  export * from './application';
3
3
  export * from './audit-log';
4
+ export * from './auto-moderation';
4
5
  export * from './ban';
5
6
  export * from './channel';
6
7
  export * from './command';
@@ -29,3 +30,5 @@ export * from './webhook';
29
30
  export declare type integer = number;
30
31
  export declare type snowflake = string;
31
32
  export declare type timestamp = string;
33
+ /** @see https://discord.com/developers/docs/reference#locales */
34
+ export declare type Locale = 'da' | 'de' | 'en-GB' | 'en-US' | 'es-ES' | 'fr' | 'hr' | 'it' | 'lt' | 'hu' | 'nl' | 'no' | 'pl' | 'pt-BR' | 'ro' | 'fi' | 'sv-SE' | 'vi' | 'tr' | 'cs' | 'el' | 'bg' | 'ru' | 'uk' | 'hi' | 'th' | 'zh-CN' | 'ja' | 'zh-TW' | 'ko';
@@ -103,10 +103,23 @@ export declare enum InteractionCallbackType {
103
103
  CHANNEL_MESSAGE_WITH_SOURCE = 4,
104
104
  /** ACK an interaction and edit a response later, the user sees a loading state */
105
105
  DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5,
106
- /** for components, ACK an interaction and edit the original message later; the user does not see a loading state */
106
+ /**
107
+ * for components, ACK an interaction and edit the original message later; the user does not see a loading state
108
+ * (only valid for [component-based](https://discord.com/developers/docs/interactions/message-components) interactions)
109
+ */
107
110
  DEFERRED_UPDATE_MESSAGE = 6,
108
- /** for components, edit the message the component was attached to */
109
- UPDATE_MESSAGE = 7
111
+ /**
112
+ * for components, edit the message the component was attached to
113
+ * (only valid for [component-based](https://discord.com/developers/docs/interactions/message-components) interactions)
114
+ */
115
+ UPDATE_MESSAGE = 7,
116
+ /** respond to an autocomplete interaction with suggested choices */
117
+ APPLICATION_COMMAND_AUTOCOMPLETE_RESULT = 8,
118
+ /**
119
+ * respond to an interaction with a popup modal
120
+ * (not available for `MODAL_SUBMIT` and `PING` interactions)
121
+ */
122
+ MODAL = 9
110
123
  }
111
124
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure */
112
125
  export interface InteractionCallbackData {
@@ -37,6 +37,13 @@ export interface ThreadMetadata {
37
37
  /** whether non-moderators can add other non-moderators to a thread; only available on private threads */
38
38
  invitable?: boolean;
39
39
  }
40
+ /** @see https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
41
+ export interface ListActiveGuildThreadsResult {
42
+ /** the active threads */
43
+ threads: Channel[];
44
+ /** a thread member object for each returned thread the current user has joined */
45
+ members: ThreadMember[];
46
+ }
40
47
  export interface Thread extends Channel {
41
48
  }
42
49
  export declare namespace Thread {
@@ -135,8 +142,9 @@ declare module './internal' {
135
142
  interface Internal {
136
143
  /**
137
144
  * Returns all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.
138
- * @see https://discord.com/developers/docs/resources/guild#list-active-threads
145
+ * @see https://discord.com/developers/docs/resources/guild#list-active-guild-threads
139
146
  */
147
+ listActiveGuildThreads(guild_id: snowflake): Promise<ListActiveGuildThreadsResult>;
140
148
  /**
141
149
  * Creates a new thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.
142
150
  * @see https://discord.com/developers/docs/resources/channel#start-thread-with-message
package/lib/ws.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="ws" />
2
3
  import { Adapter, Schema } from '@satorijs/satori';
3
4
  import { DiscordBot } from './bot';
4
5
  export declare class WsClient extends Adapter.WsClient<DiscordBot> {
5
6
  _d: number;
6
7
  _ping: NodeJS.Timeout;
7
8
  _sessionId: string;
8
- prepare(): any;
9
+ prepare(): import("ws").WebSocket;
9
10
  heartbeat(): void;
10
11
  accept(): void;
11
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@satorijs/adapter-discord",
3
3
  "description": "Discord Adapter for Satorijs",
4
- "version": "3.1.1",
4
+ "version": "3.2.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -32,7 +32,7 @@
32
32
  "@types/es-aggregate-error": "^1.0.2"
33
33
  },
34
34
  "peerDependencies": {
35
- "@satorijs/satori": "^1.1.2"
35
+ "@satorijs/satori": "^1.1.6"
36
36
  },
37
37
  "dependencies": {
38
38
  "es-aggregate-error": "^1.0.8",