@discordjs/structures 0.2.0-dev.1769083302-838cd2da3 → 0.2.0-dev.1769385723-323d8e757
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.
- package/dist/index.d.mts +304 -124
- package/dist/index.d.ts +304 -124
- package/dist/index.js +340 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +336 -117
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import * as discord_api_types_v10 from 'discord-api-types/v10';
|
|
2
|
-
import { AttachmentFlags, ChannelFlags, MessageFlags, PermissionFlagsBits, GuildChannelType, ChannelType, ThreadChannelType, GuildTextChannelType, TextChannelType, APIChannel, APIPartialChannel, APIGuildForumTag, APIOverwrite, APIThreadMetadata, APINewsChannel, APIAnnouncementThreadChannel, APIGuildCategoryChannel, APIDMChannel, APIGuildForumChannel, APIGroupDMChannel, APIGuildMediaChannel, APIPrivateThreadChannel, APIPublicThreadChannel, APIGuildStageVoiceChannel, APITextChannel, APIGuildVoiceChannel, APIEmoji, APIEntitlement, APIInteractionDataResolved, APIInvite, APIExtendedInvite, APIMessageComponent, APIModalComponent, ComponentType, APIBaseComponent, APIComponentInActionRow, APIActionRowComponent, ButtonStyle, APIButtonComponentWithCustomId, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, APIContainerComponent, APIFileComponent, APIFileUploadComponent, APIButtonComponentWithURL, APIMediaGalleryComponent, APIMentionableSelectComponent, APIButtonComponentWithSKUId, APIRoleSelectComponent, APISectionComponent, APISeparatorComponent, APIStringSelectComponent, APITextDisplayComponent, APITextInputComponent, APIThumbnailComponent, APIUserSelectComponent, APIMessageComponentEmoji, APIMediaGalleryItem, SelectMenuDefaultValueType, APISelectMenuDefaultValue, APISelectMenuOption, APIUnfurledMediaItem, APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage, APIEmbedProvider, APIEmbedThumbnail, APIEmbedVideo, InteractionType, APIMessageInteractionMetadata, APIApplicationCommandInteractionMetadata, APIAttachment, APIChannelMention, APIMessage, APIMessageActivity, APIMessageCall, APIMessageComponentInteractionMetadata, APIMessageReference, MessageReferenceType, APIModalSubmitInteractionMetadata, APIReaction, APIReactionCountDetails, APIMessageRoleSubscriptionData, APIPoll, APIPollAnswer, APIPollAnswerCount, APIPollMedia, APIPollResults, APISticker, APIAvatarDecorationData, APIUser, APIConnection } from 'discord-api-types/v10';
|
|
2
|
+
import { APIAutoModerationAction, APIAutoModerationActionMetadata, APIAutoModerationRule, APIAutoModerationRuleTriggerMetadata, AttachmentFlags, ChannelFlags, MessageFlags, PermissionFlagsBits, GuildChannelType, ChannelType, ThreadChannelType, GuildTextChannelType, TextChannelType, APIChannel, APIPartialChannel, APIGuildForumTag, APIOverwrite, APIThreadMetadata, APINewsChannel, APIAnnouncementThreadChannel, APIGuildCategoryChannel, APIDMChannel, APIGuildForumChannel, APIGroupDMChannel, APIGuildMediaChannel, APIPrivateThreadChannel, APIPublicThreadChannel, APIGuildStageVoiceChannel, APITextChannel, APIGuildVoiceChannel, APIEmoji, APIEntitlement, APIInteractionDataResolved, APIInvite, APIExtendedInvite, APIMessageComponent, APIModalComponent, ComponentType, APIBaseComponent, APIComponentInActionRow, APIActionRowComponent, ButtonStyle, APIButtonComponentWithCustomId, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, APIContainerComponent, APIFileComponent, APIFileUploadComponent, APIButtonComponentWithURL, APIMediaGalleryComponent, APIMentionableSelectComponent, APIButtonComponentWithSKUId, APIRoleSelectComponent, APISectionComponent, APISeparatorComponent, APIStringSelectComponent, APITextDisplayComponent, APITextInputComponent, APIThumbnailComponent, APIUserSelectComponent, APIMessageComponentEmoji, APIMediaGalleryItem, SelectMenuDefaultValueType, APISelectMenuDefaultValue, APISelectMenuOption, APIUnfurledMediaItem, APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage, APIEmbedProvider, APIEmbedThumbnail, APIEmbedVideo, InteractionType, APIMessageInteractionMetadata, APIApplicationCommandInteractionMetadata, APIAttachment, APIChannelMention, APIMessage, APIMessageActivity, APIMessageCall, APIMessageComponentInteractionMetadata, APIMessageReference, MessageReferenceType, APIModalSubmitInteractionMetadata, APIReaction, APIReactionCountDetails, APIMessageRoleSubscriptionData, APIPoll, APIPollAnswer, APIPollAnswerCount, APIPollMedia, APIPollResults, APISticker, APIAvatarDecorationData, APIUser, APIConnection } from 'discord-api-types/v10';
|
|
3
|
+
|
|
4
|
+
declare const kData: unique symbol;
|
|
5
|
+
declare const kClone: unique symbol;
|
|
6
|
+
declare const kPatch: unique symbol;
|
|
7
|
+
declare const kExpiresTimestamp: unique symbol;
|
|
8
|
+
declare const kEndedTimestamp: unique symbol;
|
|
9
|
+
declare const kCreatedTimestamp: unique symbol;
|
|
10
|
+
declare const kEditedTimestamp: unique symbol;
|
|
11
|
+
declare const kArchiveTimestamp: unique symbol;
|
|
12
|
+
declare const kStartsTimestamp: unique symbol;
|
|
13
|
+
declare const kEndsTimestamp: unique symbol;
|
|
14
|
+
declare const kAllow: unique symbol;
|
|
15
|
+
declare const kDeny: unique symbol;
|
|
16
|
+
declare const kBurstColors: unique symbol;
|
|
17
|
+
declare const kLastPinTimestamp: unique symbol;
|
|
18
|
+
declare const kMixinConstruct: unique symbol;
|
|
19
|
+
declare const kMixinToJSON: unique symbol;
|
|
3
20
|
|
|
4
21
|
type ReplaceOmittedWithUnknown<Omitted extends keyof Data | '', Data> = {
|
|
5
22
|
[Key in keyof Data]: Key extends Omitted ? unknown : Data[Key];
|
|
@@ -23,6 +40,291 @@ type If<Check, Value, True, False = never> = Check extends Value ? (Value extend
|
|
|
23
40
|
type NonAbstract<Type extends abstract new (...args: any) => any> = Type extends abstract new (...args: infer Args) => infer Instance ? Pick<Type, keyof Type> & (new (...args: Args) => Instance) : never;
|
|
24
41
|
type Partialize<Type, Omitted extends keyof Type | ''> = Omit<Type, Omitted> & Partial<Pick<Type, Exclude<Omitted, ''>>>;
|
|
25
42
|
|
|
43
|
+
declare const DataTemplatePropertyName = "DataTemplate";
|
|
44
|
+
declare const OptimizeDataPropertyName = "optimizeData";
|
|
45
|
+
/**
|
|
46
|
+
* Represents a data model from the Discord API
|
|
47
|
+
*
|
|
48
|
+
* @privateRemarks
|
|
49
|
+
* Explanation of the type complexity surround Structure:
|
|
50
|
+
*
|
|
51
|
+
* There are two layers of Omitted generics, one here, which allows omitting things at the library level so we do not accidentally
|
|
52
|
+
* access them, in addition to whatever the user does at the layer above.
|
|
53
|
+
*
|
|
54
|
+
* The second layer, in the exported structure is effectively a type cast that allows the getters types to match whatever data template is used
|
|
55
|
+
*
|
|
56
|
+
* In order to safely set and access this data, the constructor and patch take data as "partial" and forcibly assigns it to kData. To accommodate this,
|
|
57
|
+
* kData stores properties as `unknown` when it is omitted, which allows accessing the property in getters even when it may not actually be present.
|
|
58
|
+
* This is the most technically correct way of representing the value, especially since there is no way to guarantee runtime matches the "type cast."
|
|
59
|
+
*/
|
|
60
|
+
declare abstract class Structure<DataType extends {}, Omitted extends keyof DataType | '' = ''> {
|
|
61
|
+
/**
|
|
62
|
+
* A construct function used when mixing to allow mixins to set optimized property defaults
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
* @remarks This should only be used to set defaults, setting optimized values should be done
|
|
66
|
+
* in the mixins `optimizeData` method, which will be called automatically.
|
|
67
|
+
* @param data - The full API data received by the Structure
|
|
68
|
+
*/
|
|
69
|
+
protected [kMixinConstruct]?(data: Partial<DataType>): void;
|
|
70
|
+
/**
|
|
71
|
+
* A function used when mixing to allow mixins to add properties to the result of toJSON
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
* @remarks This should only be used to add properties that the mixin optimizes, if the raw
|
|
75
|
+
* JSON data is unchanged the property will already be returned.
|
|
76
|
+
* @param data - The result of the base class toJSON Structure before it gets returned
|
|
77
|
+
*/
|
|
78
|
+
protected [kMixinToJSON]?(data: Partial<DataType>): void;
|
|
79
|
+
/**
|
|
80
|
+
* The template used for removing data from the raw data stored for each Structure.
|
|
81
|
+
*
|
|
82
|
+
* @remarks This template should be overridden in all subclasses to provide more accurate type information.
|
|
83
|
+
* The template in the base {@link Structure} class will have no effect on most subclasses for this reason.
|
|
84
|
+
*/
|
|
85
|
+
protected static readonly DataTemplate: Record<string, unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* @returns A cloned version of the data template, ready to create a new data object.
|
|
88
|
+
*/
|
|
89
|
+
private getDataTemplate;
|
|
90
|
+
/**
|
|
91
|
+
* The raw data from the API for this structure
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
protected [kData]: Readonly<ReplaceOmittedWithUnknown<Omitted, DataType>>;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new structure to represent API data
|
|
98
|
+
*
|
|
99
|
+
* @param data - the data from the API that this structure will represent
|
|
100
|
+
* @remarks To be made public in subclasses
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
constructor(data: Readonly<Partial<DataType>>, ..._rest: unknown[]);
|
|
104
|
+
/**
|
|
105
|
+
* Patches the raw data of this object in place
|
|
106
|
+
*
|
|
107
|
+
* @param data - the updated data from the API to patch with
|
|
108
|
+
* @remarks To be made public in subclasses
|
|
109
|
+
* @returns this
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
protected [kPatch](data: Readonly<Partial<DataType>>): this;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a clone of this structure
|
|
115
|
+
*
|
|
116
|
+
* @returns a clone of this
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
protected [kClone](patchPayload?: Readonly<Partial<DataType>>): typeof this;
|
|
120
|
+
/**
|
|
121
|
+
* Function called to ensure stored raw data is in optimized formats, used in tandem with a data template
|
|
122
|
+
*
|
|
123
|
+
* @example created_timestamp is an ISO string, this can be stored in optimized form as a number
|
|
124
|
+
* @param _data - the raw data received from the API to optimize
|
|
125
|
+
* @remarks Implementation to be done in subclasses and mixins where needed.
|
|
126
|
+
* For typescript users, mixins must use the closest ancestors access modifier.
|
|
127
|
+
* @remarks Automatically called in Structure[kPatch] but must be called manually in the constructor
|
|
128
|
+
* of any class implementing this method.
|
|
129
|
+
* @remarks Additionally, when implementing, ensure to call `super._optimizeData` if any class in the super chain aside
|
|
130
|
+
* from Structure contains an implementation.
|
|
131
|
+
* Note: mixins do not need to call super ever as the process of mixing walks the prototype chain.
|
|
132
|
+
* @virtual
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
protected optimizeData(_data: Partial<DataType>): void;
|
|
136
|
+
/**
|
|
137
|
+
* Transforms this object to its JSON format with raw API data (or close to it),
|
|
138
|
+
* automatically called by `JSON.stringify()` when this structure is stringified
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* The type of this data is determined by omissions at runtime and is only guaranteed for default omissions
|
|
142
|
+
* @privateRemarks
|
|
143
|
+
* When omitting properties at the library level, this must be overridden to re-add those properties
|
|
144
|
+
*/
|
|
145
|
+
toJSON(): DataType;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Represents an auto moderation action on Discord.
|
|
150
|
+
*
|
|
151
|
+
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
|
|
152
|
+
* @remarks has substructure `ActionMetadata` which needs to be instantiated and stored by an extending class using it
|
|
153
|
+
*/
|
|
154
|
+
declare class AutoModerationAction<Omitted extends keyof APIAutoModerationAction | '' = ''> extends Structure<APIAutoModerationAction, Omitted> {
|
|
155
|
+
/**
|
|
156
|
+
* The template used for removing data from the raw data stored for each auto moderation action
|
|
157
|
+
*/
|
|
158
|
+
static DataTemplate: Partial<APIAutoModerationAction>;
|
|
159
|
+
/**
|
|
160
|
+
* @param data - The raw data received from the API for the auto moderation action
|
|
161
|
+
*/
|
|
162
|
+
constructor(data: Partialize<APIAutoModerationAction, Omitted>);
|
|
163
|
+
/**
|
|
164
|
+
* The {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types | action type}
|
|
165
|
+
*/
|
|
166
|
+
get type(): "type" extends infer T ? T extends "type" ? T extends Omitted ? unknown : APIAutoModerationAction[T] : never : never;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Represents an auto moderation action metadata on Discord.
|
|
171
|
+
*
|
|
172
|
+
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
|
|
173
|
+
*/
|
|
174
|
+
declare class AutoModerationActionMetadata<Omitted extends keyof APIAutoModerationActionMetadata | '' = ''> extends Structure<APIAutoModerationActionMetadata, Omitted> {
|
|
175
|
+
/**
|
|
176
|
+
* The template used for removing data from the raw data stored for each auto moderation action metadata
|
|
177
|
+
*/
|
|
178
|
+
static DataTemplate: Partial<APIAutoModerationActionMetadata>;
|
|
179
|
+
/**
|
|
180
|
+
* @param data - The raw data received from the API for the auto moderation action metadata
|
|
181
|
+
*/
|
|
182
|
+
constructor(data: Partialize<APIAutoModerationActionMetadata, Omitted>);
|
|
183
|
+
/**
|
|
184
|
+
* Channel to which user content should be logged. This must be an existing channel
|
|
185
|
+
*
|
|
186
|
+
* Associated action types: {@link AutoModerationActionType.SendAlertMessage}
|
|
187
|
+
*/
|
|
188
|
+
get channelId(): ("channel_id" extends infer T ? T extends "channel_id" ? T extends Omitted ? unknown : APIAutoModerationActionMetadata[T] : never : never) | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Timeout duration in seconds. Maximum of 2419200 seconds (4 weeks).
|
|
191
|
+
*
|
|
192
|
+
* A `TIMEOUT` action can only be set up for {@link AutoModerationRuleTriggerType.Keyword} and {@link AutoModerationRuleTriggerType.MentionSpam}.
|
|
193
|
+
*
|
|
194
|
+
* The `MODERATE_MEMBERS` permission is required to use {@link AutoModerationActionType.Timeout} actions.
|
|
195
|
+
*
|
|
196
|
+
* Associated action types: {@link AutoModerationActionType.Timeout}
|
|
197
|
+
*/
|
|
198
|
+
get durationSeconds(): ("duration_seconds" extends infer T ? T extends "duration_seconds" ? T extends Omitted ? unknown : APIAutoModerationActionMetadata[T] : never : never) | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* Additional explanation that will be shown to members whenever their message is blocked. Maximum of 150 characters
|
|
201
|
+
*
|
|
202
|
+
* Associated action types: {@link AutoModerationActionType.BlockMessage}
|
|
203
|
+
*/
|
|
204
|
+
get customMessage(): ("custom_message" extends infer T ? T extends "custom_message" ? T extends Omitted ? unknown : APIAutoModerationActionMetadata[T] : never : never) | undefined;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Represents an auto moderation rule on Discord.
|
|
209
|
+
*
|
|
210
|
+
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
|
|
211
|
+
* @remarks has substructure `TriggerMetadata` which needs to be instantiated and stored by an extending class using it
|
|
212
|
+
* @remarks intentionally does not export `exemptRoles` and `exemptChannels` so that extending classes can resolve `Snowflake[]` to `Role[]` and `Channel[]`, respectively
|
|
213
|
+
*/
|
|
214
|
+
declare class AutoModerationRule<Omitted extends keyof APIAutoModerationRule | '' = ''> extends Structure<APIAutoModerationRule, Omitted> {
|
|
215
|
+
/**
|
|
216
|
+
* The template used for removing data from the raw data stored for each auto moderation rule
|
|
217
|
+
*/
|
|
218
|
+
static DataTemplate: Partial<APIAutoModerationRule>;
|
|
219
|
+
/**
|
|
220
|
+
* @param data - The raw data received from the API for the auto moderation rule
|
|
221
|
+
*/
|
|
222
|
+
constructor(data: Partialize<APIAutoModerationRule, Omitted>);
|
|
223
|
+
/**
|
|
224
|
+
* The id of this rule
|
|
225
|
+
*/
|
|
226
|
+
get id(): "id" extends infer T ? T extends "id" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
227
|
+
/**
|
|
228
|
+
* The id of the guild which this rule belongs to
|
|
229
|
+
*/
|
|
230
|
+
get guildId(): "guild_id" extends infer T ? T extends "guild_id" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
231
|
+
/**
|
|
232
|
+
* The rule name
|
|
233
|
+
*/
|
|
234
|
+
get name(): "name" extends infer T ? T extends "name" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
235
|
+
/**
|
|
236
|
+
* The user who first created this rule
|
|
237
|
+
*/
|
|
238
|
+
get creatorId(): "creator_id" extends infer T ? T extends "creator_id" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
239
|
+
/**
|
|
240
|
+
* The rule {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types | event type}
|
|
241
|
+
*/
|
|
242
|
+
get eventType(): "event_type" extends infer T ? T extends "event_type" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
243
|
+
/**
|
|
244
|
+
* The rule {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types | trigger type}
|
|
245
|
+
*/
|
|
246
|
+
get triggerType(): "trigger_type" extends infer T ? T extends "trigger_type" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
247
|
+
/**
|
|
248
|
+
* Whether the rule is enabled
|
|
249
|
+
*/
|
|
250
|
+
get enabled(): "enabled" extends infer T ? T extends "enabled" ? T extends Omitted ? unknown : APIAutoModerationRule[T] : never : never;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Represents an auto moderation rule trigger metadata on Discord.
|
|
255
|
+
*
|
|
256
|
+
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
|
|
257
|
+
*/
|
|
258
|
+
declare class AutoModerationRuleTriggerMetadata<Omitted extends keyof APIAutoModerationRuleTriggerMetadata | '' = ''> extends Structure<APIAutoModerationRuleTriggerMetadata, Omitted> {
|
|
259
|
+
/**
|
|
260
|
+
* The template used for removing data from the raw data stored for each auto moderation rule trigger metadata
|
|
261
|
+
*/
|
|
262
|
+
static DataTemplate: Partial<APIAutoModerationRuleTriggerMetadata>;
|
|
263
|
+
/**
|
|
264
|
+
* @param data - The raw data received from the API for the auto moderation rule trigger metadata
|
|
265
|
+
*/
|
|
266
|
+
constructor(data: Partialize<APIAutoModerationRuleTriggerMetadata, Omitted>);
|
|
267
|
+
/**
|
|
268
|
+
* Substrings which will be searched for in content (Maximum of 1000)
|
|
269
|
+
*
|
|
270
|
+
* A keyword can be a phrase which contains multiple words.
|
|
271
|
+
*
|
|
272
|
+
* Wildcard symbols can be used to customize how each keyword will be matched. Each keyword must be 60 characters or less.
|
|
273
|
+
*
|
|
274
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies | Keyword matching strategies}
|
|
275
|
+
*
|
|
276
|
+
* Associated trigger types: {@link AutoModerationRuleTriggerType.Keyword}, {@link AutoModerationRuleTriggerType.MemberProfile}
|
|
277
|
+
*/
|
|
278
|
+
get keywordFilter(): ("keyword_filter" extends infer T ? T extends "keyword_filter" ? T extends Omitted ? unknown : APIAutoModerationRuleTriggerMetadata[T] : never : never) | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* Regular expression patterns which will be matched against content (Maximum of 10)
|
|
281
|
+
*
|
|
282
|
+
* Only Rust flavored regex is currently supported, which can be tested in online editors such as {@link https://rustexp.lpil.uk/ | Rustexp}.
|
|
283
|
+
*
|
|
284
|
+
* Each regex pattern must be 260 characters or less.
|
|
285
|
+
*
|
|
286
|
+
* Associated trigger types: {@link AutoModerationRuleTriggerType.Keyword}, {@link AutoModerationRuleTriggerType.MemberProfile}
|
|
287
|
+
*/
|
|
288
|
+
get regexPatterns(): ("regex_patterns" extends infer T ? T extends "regex_patterns" ? T extends Omitted ? unknown : APIAutoModerationRuleTriggerMetadata[T] : never : never) | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* The internally pre-defined wordsets which will be searched for in content
|
|
291
|
+
*
|
|
292
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types | Keyword preset types}
|
|
293
|
+
*
|
|
294
|
+
* Associated trigger types: {@link AutoModerationRuleTriggerType.KeywordPreset}
|
|
295
|
+
*/
|
|
296
|
+
get presets(): ("presets" extends infer T ? T extends "presets" ? T extends Omitted ? unknown : APIAutoModerationRuleTriggerMetadata[T] : never : never) | undefined;
|
|
297
|
+
/**
|
|
298
|
+
* Substrings which should not trigger the rule (Maximum of 100 or 1000).
|
|
299
|
+
*
|
|
300
|
+
* Wildcard symbols can be used to customize how each keyword will be matched (see Keyword matching strategies).
|
|
301
|
+
*
|
|
302
|
+
* Each `allow_list` keyword can be a phrase which contains multiple words.
|
|
303
|
+
*
|
|
304
|
+
* Rules with `KEYWORD` triggerType accept a maximum of 100 keywords.
|
|
305
|
+
*
|
|
306
|
+
* Rules with `KEYWORD_PRESET` triggerType accept a maximum of 1000 keywords.
|
|
307
|
+
*
|
|
308
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types | triggerType}
|
|
309
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies | Keyword matching strategies}
|
|
310
|
+
*
|
|
311
|
+
* Associated trigger types: {@link AutoModerationRuleTriggerType.Keyword}, {@link AutoModerationRuleTriggerType.KeywordPreset}, {@link AutoModerationRuleTriggerType.MemberProfile}
|
|
312
|
+
*/
|
|
313
|
+
get allowList(): ("allow_list" extends infer T ? T extends "allow_list" ? T extends Omitted ? unknown : APIAutoModerationRuleTriggerMetadata[T] : never : never) | undefined;
|
|
314
|
+
/**
|
|
315
|
+
* Total number of unique role and user mentions allowed per message (Maximum of 50)
|
|
316
|
+
*
|
|
317
|
+
* Associated trigger types: {@link AutoModerationRuleTriggerType.MentionSpam}
|
|
318
|
+
*/
|
|
319
|
+
get mentionTotalLimit(): ("mention_total_limit" extends infer T ? T extends "mention_total_limit" ? T extends Omitted ? unknown : APIAutoModerationRuleTriggerMetadata[T] : never : never) | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* Whether to automatically detect mention raids
|
|
322
|
+
*
|
|
323
|
+
* Associated trigger types: {@link AutoModerationRuleTriggerType.MentionSpam}
|
|
324
|
+
*/
|
|
325
|
+
get mentionRaidProtectionEnabled(): ("mention_raid_protection_enabled" extends infer T ? T extends "mention_raid_protection_enabled" ? T extends Omitted ? unknown : APIAutoModerationRuleTriggerMetadata[T] : never : never) | undefined;
|
|
326
|
+
}
|
|
327
|
+
|
|
26
328
|
/**
|
|
27
329
|
* Data that can be resolved to give a bit field. This can be:
|
|
28
330
|
* A bit number (this can be a number literal or a value taken from {@link (BitField:class).Flags})
|
|
@@ -268,128 +570,6 @@ declare class PermissionsBitField extends BitField<keyof typeof PermissionFlagsB
|
|
|
268
570
|
toArray(): ("CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTTSMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "ViewGuildInsights" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVAD" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageEmojisAndStickers" | "ManageGuildExpressions" | "UseApplicationCommands" | "RequestToSpeak" | "ManageEvents" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "UseEmbeddedActivities" | "ModerateMembers" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[];
|
|
269
571
|
}
|
|
270
572
|
|
|
271
|
-
declare const kData: unique symbol;
|
|
272
|
-
declare const kClone: unique symbol;
|
|
273
|
-
declare const kPatch: unique symbol;
|
|
274
|
-
declare const kExpiresTimestamp: unique symbol;
|
|
275
|
-
declare const kEndedTimestamp: unique symbol;
|
|
276
|
-
declare const kCreatedTimestamp: unique symbol;
|
|
277
|
-
declare const kEditedTimestamp: unique symbol;
|
|
278
|
-
declare const kArchiveTimestamp: unique symbol;
|
|
279
|
-
declare const kStartsTimestamp: unique symbol;
|
|
280
|
-
declare const kEndsTimestamp: unique symbol;
|
|
281
|
-
declare const kAllow: unique symbol;
|
|
282
|
-
declare const kDeny: unique symbol;
|
|
283
|
-
declare const kBurstColors: unique symbol;
|
|
284
|
-
declare const kLastPinTimestamp: unique symbol;
|
|
285
|
-
declare const kMixinConstruct: unique symbol;
|
|
286
|
-
declare const kMixinToJSON: unique symbol;
|
|
287
|
-
|
|
288
|
-
declare const DataTemplatePropertyName = "DataTemplate";
|
|
289
|
-
declare const OptimizeDataPropertyName = "optimizeData";
|
|
290
|
-
/**
|
|
291
|
-
* Represents a data model from the Discord API
|
|
292
|
-
*
|
|
293
|
-
* @privateRemarks
|
|
294
|
-
* Explanation of the type complexity surround Structure:
|
|
295
|
-
*
|
|
296
|
-
* There are two layers of Omitted generics, one here, which allows omitting things at the library level so we do not accidentally
|
|
297
|
-
* access them, in addition to whatever the user does at the layer above.
|
|
298
|
-
*
|
|
299
|
-
* The second layer, in the exported structure is effectively a type cast that allows the getters types to match whatever data template is used
|
|
300
|
-
*
|
|
301
|
-
* In order to safely set and access this data, the constructor and patch take data as "partial" and forcibly assigns it to kData. To accommodate this,
|
|
302
|
-
* kData stores properties as `unknown` when it is omitted, which allows accessing the property in getters even when it may not actually be present.
|
|
303
|
-
* This is the most technically correct way of representing the value, especially since there is no way to guarantee runtime matches the "type cast."
|
|
304
|
-
*/
|
|
305
|
-
declare abstract class Structure<DataType extends {}, Omitted extends keyof DataType | '' = ''> {
|
|
306
|
-
/**
|
|
307
|
-
* A construct function used when mixing to allow mixins to set optimized property defaults
|
|
308
|
-
*
|
|
309
|
-
* @internal
|
|
310
|
-
* @remarks This should only be used to set defaults, setting optimized values should be done
|
|
311
|
-
* in the mixins `optimizeData` method, which will be called automatically.
|
|
312
|
-
* @param data - The full API data received by the Structure
|
|
313
|
-
*/
|
|
314
|
-
protected [kMixinConstruct]?(data: Partial<DataType>): void;
|
|
315
|
-
/**
|
|
316
|
-
* A function used when mixing to allow mixins to add properties to the result of toJSON
|
|
317
|
-
*
|
|
318
|
-
* @internal
|
|
319
|
-
* @remarks This should only be used to add properties that the mixin optimizes, if the raw
|
|
320
|
-
* JSON data is unchanged the property will already be returned.
|
|
321
|
-
* @param data - The result of the base class toJSON Structure before it gets returned
|
|
322
|
-
*/
|
|
323
|
-
protected [kMixinToJSON]?(data: Partial<DataType>): void;
|
|
324
|
-
/**
|
|
325
|
-
* The template used for removing data from the raw data stored for each Structure.
|
|
326
|
-
*
|
|
327
|
-
* @remarks This template should be overridden in all subclasses to provide more accurate type information.
|
|
328
|
-
* The template in the base {@link Structure} class will have no effect on most subclasses for this reason.
|
|
329
|
-
*/
|
|
330
|
-
protected static readonly DataTemplate: Record<string, unknown>;
|
|
331
|
-
/**
|
|
332
|
-
* @returns A cloned version of the data template, ready to create a new data object.
|
|
333
|
-
*/
|
|
334
|
-
private getDataTemplate;
|
|
335
|
-
/**
|
|
336
|
-
* The raw data from the API for this structure
|
|
337
|
-
*
|
|
338
|
-
* @internal
|
|
339
|
-
*/
|
|
340
|
-
protected [kData]: Readonly<ReplaceOmittedWithUnknown<Omitted, DataType>>;
|
|
341
|
-
/**
|
|
342
|
-
* Creates a new structure to represent API data
|
|
343
|
-
*
|
|
344
|
-
* @param data - the data from the API that this structure will represent
|
|
345
|
-
* @remarks To be made public in subclasses
|
|
346
|
-
* @internal
|
|
347
|
-
*/
|
|
348
|
-
constructor(data: Readonly<Partial<DataType>>, ..._rest: unknown[]);
|
|
349
|
-
/**
|
|
350
|
-
* Patches the raw data of this object in place
|
|
351
|
-
*
|
|
352
|
-
* @param data - the updated data from the API to patch with
|
|
353
|
-
* @remarks To be made public in subclasses
|
|
354
|
-
* @returns this
|
|
355
|
-
* @internal
|
|
356
|
-
*/
|
|
357
|
-
protected [kPatch](data: Readonly<Partial<DataType>>): this;
|
|
358
|
-
/**
|
|
359
|
-
* Creates a clone of this structure
|
|
360
|
-
*
|
|
361
|
-
* @returns a clone of this
|
|
362
|
-
* @internal
|
|
363
|
-
*/
|
|
364
|
-
protected [kClone](patchPayload?: Readonly<Partial<DataType>>): typeof this;
|
|
365
|
-
/**
|
|
366
|
-
* Function called to ensure stored raw data is in optimized formats, used in tandem with a data template
|
|
367
|
-
*
|
|
368
|
-
* @example created_timestamp is an ISO string, this can be stored in optimized form as a number
|
|
369
|
-
* @param _data - the raw data received from the API to optimize
|
|
370
|
-
* @remarks Implementation to be done in subclasses and mixins where needed.
|
|
371
|
-
* For typescript users, mixins must use the closest ancestors access modifier.
|
|
372
|
-
* @remarks Automatically called in Structure[kPatch] but must be called manually in the constructor
|
|
373
|
-
* of any class implementing this method.
|
|
374
|
-
* @remarks Additionally, when implementing, ensure to call `super._optimizeData` if any class in the super chain aside
|
|
375
|
-
* from Structure contains an implementation.
|
|
376
|
-
* Note: mixins do not need to call super ever as the process of mixing walks the prototype chain.
|
|
377
|
-
* @virtual
|
|
378
|
-
* @internal
|
|
379
|
-
*/
|
|
380
|
-
protected optimizeData(_data: Partial<DataType>): void;
|
|
381
|
-
/**
|
|
382
|
-
* Transforms this object to its JSON format with raw API data (or close to it),
|
|
383
|
-
* automatically called by `JSON.stringify()` when this structure is stringified
|
|
384
|
-
*
|
|
385
|
-
* @remarks
|
|
386
|
-
* The type of this data is determined by omissions at runtime and is only guaranteed for default omissions
|
|
387
|
-
* @privateRemarks
|
|
388
|
-
* When omitting properties at the library level, this must be overridden to re-add those properties
|
|
389
|
-
*/
|
|
390
|
-
toJSON(): DataType;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
573
|
interface ChannelPermissionMixin<Type extends Exclude<GuildChannelType, ChannelType.GuildDirectory | ThreadChannelType> = Exclude<GuildChannelType, ChannelType.GuildDirectory | ThreadChannelType>> extends Channel<Type> {
|
|
394
574
|
}
|
|
395
575
|
/**
|
|
@@ -3087,4 +3267,4 @@ declare function extendTemplate<SuperTemplate extends Record<string, unknown>>(s
|
|
|
3087
3267
|
*/
|
|
3088
3268
|
declare function dateToDiscordISOTimestamp(date: Date): string;
|
|
3089
3269
|
|
|
3090
|
-
export { type APIActualInvite, ActionRowComponent, AnnouncementChannel, AnnouncementThreadChannel, ApplicationCommandInteractionMetadata, AppliedTagsMixin, Attachment, AttachmentFlagsBitField, AvatarDecorationData, BitField, type BitFieldResolvable, ButtonComponent, type ButtonDataType, CategoryChannel, Channel, type ChannelDataType, ChannelFlagsBitField, ChannelMention, ChannelOwnerMixin, ChannelParentMixin, ChannelPermissionMixin, ChannelPinMixin, ChannelSelectMenuComponent, ChannelSlowmodeMixin, ChannelTopicMixin, ChannelWebhookMixin, type CollapseUnion, Component, type ComponentDataType, ComponentEmoji, Connection, ContainerComponent, DMChannel, DMChannelMixin, DataTemplatePropertyName, Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedProvider, EmbedThumbnail, EmbedVideo, Emoji, Entitlement, type EnumLike, FileComponent, FileUploadComponent, ForumChannel, ForumTag, GroupDMChannel, GroupDMMixin, GuildChannelMixin, type If, InteractionMetadata, type InteractionMetadataType, InteractiveButtonComponent, Invite, LabeledButtonComponent, LinkButtonComponent, MediaChannel, MediaGalleryComponent, MediaGalleryItem, MentionableSelectMenuComponent, type MergePrototype, type MergePrototypes, Message, MessageActivity, MessageCall, MessageComponentInteractionMetadata, MessageFlagsBitField, MessageReference, Mixin, type MixinBase, type MixinTypes, type Mixinable, ModalSubmitInteractionMetadata, type NonAbstract, OptimizeDataPropertyName, type OptionalPropertyNames, type PartialChannel, type Partialize, PermissionOverwrite, PermissionsBitField, Poll, PollAnswer, PollAnswerCount, PollMedia, PollResults, PremiumButtonComponent, PrivateThreadChannel, PublicThreadChannel, Reaction, ReactionCountDetails, type RecursiveReadonlyArray, type ReplaceOmittedWithUnknown, ResolvedInteractionData, RoleSelectMenuComponent, RoleSubscriptionData, SectionComponent, SelectMenuComponent, SelectMenuDefaultValue, SeparatorComponent, StageChannel, Sticker, StringSelectMenuComponent, StringSelectMenuOption, Structure, TextChannel, TextChannelMixin, TextDisplayComponent, TextInputComponent, ThreadChannelMixin, ThreadMetadata, ThreadOnlyChannelMixin, ThumbnailComponent, UnfurledMediaItem, User, UserSelectMenuComponent, VoiceChannel, VoiceChannelMixin, dateToDiscordISOTimestamp, extendTemplate };
|
|
3270
|
+
export { type APIActualInvite, ActionRowComponent, AnnouncementChannel, AnnouncementThreadChannel, ApplicationCommandInteractionMetadata, AppliedTagsMixin, Attachment, AttachmentFlagsBitField, AutoModerationAction, AutoModerationActionMetadata, AutoModerationRule, AutoModerationRuleTriggerMetadata, AvatarDecorationData, BitField, type BitFieldResolvable, ButtonComponent, type ButtonDataType, CategoryChannel, Channel, type ChannelDataType, ChannelFlagsBitField, ChannelMention, ChannelOwnerMixin, ChannelParentMixin, ChannelPermissionMixin, ChannelPinMixin, ChannelSelectMenuComponent, ChannelSlowmodeMixin, ChannelTopicMixin, ChannelWebhookMixin, type CollapseUnion, Component, type ComponentDataType, ComponentEmoji, Connection, ContainerComponent, DMChannel, DMChannelMixin, DataTemplatePropertyName, Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedProvider, EmbedThumbnail, EmbedVideo, Emoji, Entitlement, type EnumLike, FileComponent, FileUploadComponent, ForumChannel, ForumTag, GroupDMChannel, GroupDMMixin, GuildChannelMixin, type If, InteractionMetadata, type InteractionMetadataType, InteractiveButtonComponent, Invite, LabeledButtonComponent, LinkButtonComponent, MediaChannel, MediaGalleryComponent, MediaGalleryItem, MentionableSelectMenuComponent, type MergePrototype, type MergePrototypes, Message, MessageActivity, MessageCall, MessageComponentInteractionMetadata, MessageFlagsBitField, MessageReference, Mixin, type MixinBase, type MixinTypes, type Mixinable, ModalSubmitInteractionMetadata, type NonAbstract, OptimizeDataPropertyName, type OptionalPropertyNames, type PartialChannel, type Partialize, PermissionOverwrite, PermissionsBitField, Poll, PollAnswer, PollAnswerCount, PollMedia, PollResults, PremiumButtonComponent, PrivateThreadChannel, PublicThreadChannel, Reaction, ReactionCountDetails, type RecursiveReadonlyArray, type ReplaceOmittedWithUnknown, ResolvedInteractionData, RoleSelectMenuComponent, RoleSubscriptionData, SectionComponent, SelectMenuComponent, SelectMenuDefaultValue, SeparatorComponent, StageChannel, Sticker, StringSelectMenuComponent, StringSelectMenuOption, Structure, TextChannel, TextChannelMixin, TextDisplayComponent, TextInputComponent, ThreadChannelMixin, ThreadMetadata, ThreadOnlyChannelMixin, ThumbnailComponent, UnfurledMediaItem, User, UserSelectMenuComponent, VoiceChannel, VoiceChannelMixin, dateToDiscordISOTimestamp, extendTemplate };
|