lolka.js 0.1.3 → 0.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.
- package/README.md +6 -6
- package/package.json +21 -52
- package/src/client/BaseClient.js +120 -0
- package/src/client/Client.js +147 -446
- package/src/client/WebhookClient.js +103 -0
- package/src/client/actions/Action.js +3 -4
- package/src/client/actions/ActionsManager.js +65 -55
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +34 -0
- package/src/client/actions/AutoModerationActionExecution.js +26 -0
- package/src/client/actions/AutoModerationRuleCreate.js +27 -0
- package/src/client/actions/AutoModerationRuleDelete.js +31 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +29 -0
- package/src/client/actions/ChannelCreate.js +3 -5
- package/src/client/actions/ChannelDelete.js +3 -4
- package/src/client/actions/ChannelUpdate.js +3 -3
- package/src/client/actions/EntitlementCreate.js +23 -0
- package/src/client/actions/EntitlementDelete.js +27 -0
- package/src/client/actions/EntitlementUpdate.js +25 -0
- package/src/client/actions/GuildAuditLogEntryCreate.js +29 -0
- package/src/client/actions/GuildBanAdd.js +20 -0
- package/src/client/actions/GuildBanRemove.js +25 -0
- package/src/client/actions/GuildChannelsPositionUpdate.js +3 -3
- package/src/client/actions/GuildDelete.js +44 -0
- package/src/client/actions/GuildEmojiCreate.js +3 -4
- package/src/client/actions/GuildEmojiDelete.js +3 -4
- package/src/client/actions/GuildEmojiUpdate.js +3 -4
- package/src/client/actions/GuildEmojisUpdate.js +2 -2
- package/src/client/actions/GuildIntegrationsUpdate.js +19 -0
- package/src/client/actions/GuildMemberRemove.js +6 -8
- package/src/client/actions/GuildMemberUpdate.js +6 -7
- package/src/client/actions/GuildRoleCreate.js +4 -6
- package/src/client/actions/GuildRoleDelete.js +3 -4
- package/src/client/actions/GuildRoleUpdate.js +39 -0
- package/src/client/actions/GuildRolesPositionUpdate.js +3 -3
- package/src/client/actions/GuildScheduledEventCreate.js +27 -0
- package/src/client/actions/GuildScheduledEventDelete.js +3 -4
- package/src/client/actions/GuildScheduledEventUpdate.js +30 -0
- package/src/client/actions/GuildScheduledEventUserAdd.js +3 -4
- package/src/client/actions/GuildScheduledEventUserRemove.js +3 -4
- package/src/client/actions/GuildSoundboardSoundDelete.js +3 -4
- package/src/client/actions/GuildStickerCreate.js +3 -4
- package/src/client/actions/GuildStickerDelete.js +3 -4
- package/src/client/actions/GuildStickerUpdate.js +3 -4
- package/src/client/actions/GuildStickersUpdate.js +2 -2
- package/src/client/actions/GuildUpdate.js +3 -4
- package/src/client/actions/InteractionCreate.js +15 -18
- package/src/client/actions/InviteCreate.js +27 -0
- package/src/client/actions/InviteDelete.js +29 -0
- package/src/client/actions/MessageCreate.js +3 -4
- package/src/client/actions/MessageDelete.js +3 -4
- package/src/client/actions/MessageDeleteBulk.js +3 -5
- package/src/client/actions/MessagePollVoteAdd.js +3 -4
- package/src/client/actions/MessagePollVoteRemove.js +3 -4
- package/src/client/actions/MessageReactionAdd.js +5 -7
- package/src/client/actions/MessageReactionRemove.js +4 -5
- package/src/client/actions/MessageReactionRemoveAll.js +4 -5
- package/src/client/actions/MessageReactionRemoveEmoji.js +4 -5
- package/src/client/actions/MessageUpdate.js +2 -2
- package/src/client/actions/PresenceUpdate.js +45 -0
- package/src/client/actions/StageInstanceCreate.js +3 -4
- package/src/client/actions/StageInstanceDelete.js +3 -4
- package/src/client/actions/StageInstanceUpdate.js +3 -4
- package/src/client/actions/ThreadCreate.js +3 -5
- package/src/client/actions/ThreadDelete.js +26 -0
- package/src/client/actions/ThreadListSync.js +60 -0
- package/src/client/actions/ThreadMemberUpdate.js +30 -0
- package/src/client/actions/ThreadMembersUpdate.js +3 -5
- package/src/client/actions/TypingStart.js +5 -6
- package/src/client/actions/UserUpdate.js +3 -4
- package/src/client/actions/VoiceStateUpdate.js +43 -0
- package/src/client/actions/WebhooksUpdate.js +37 -0
- package/src/client/voice/ClientVoiceManager.js +6 -10
- package/src/client/websocket/WebSocketManager.js +407 -0
- package/src/client/websocket/WebSocketShard.js +234 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +2 -27
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +2 -15
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +2 -16
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +2 -19
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +2 -18
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -2
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +2 -12
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +2 -16
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +2 -14
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +2 -13
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +2 -18
- package/src/client/websocket/handlers/GUILD_CREATE.js +5 -7
- package/src/client/websocket/handlers/GUILD_DELETE.js +2 -34
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +2 -13
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +1 -3
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +11 -9
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +2 -2
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +2 -2
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +2 -19
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +2 -15
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +1 -2
- package/src/client/websocket/handlers/INVITE_CREATE.js +2 -18
- package/src/client/websocket/handlers/INVITE_DELETE.js +2 -21
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -2
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +2 -40
- package/src/client/websocket/handlers/RATE_LIMITED.js +2 -1
- package/src/client/websocket/handlers/READY.js +5 -8
- package/src/client/websocket/handlers/RESUMED.js +14 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.js +1 -2
- package/src/client/websocket/handlers/THREAD_DELETE.js +2 -15
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +2 -49
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +2 -23
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -2
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +2 -3
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +3 -30
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +2 -35
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +2 -14
- package/src/client/websocket/handlers/index.js +75 -74
- package/src/errors/DJSError.js +7 -7
- package/src/errors/ErrorCodes.js +134 -58
- package/src/errors/Messages.js +143 -115
- package/src/errors/index.js +3 -5
- package/src/index.js +227 -234
- package/src/managers/ApplicationCommandManager.js +24 -60
- package/src/managers/ApplicationCommandPermissionsManager.js +33 -57
- package/src/managers/ApplicationEmojiManager.js +8 -18
- package/src/managers/AutoModerationRuleManager.js +6 -24
- package/src/managers/BaseGuildEmojiManager.js +85 -0
- package/src/managers/BaseManager.js +1 -3
- package/src/managers/CachedManager.js +8 -12
- package/src/managers/CategoryChannelChildManager.js +4 -10
- package/src/managers/ChannelManager.js +8 -70
- package/src/managers/DMMessageManager.js +2 -4
- package/src/managers/DataManager.js +5 -10
- package/src/managers/EntitlementManager.js +8 -19
- package/src/managers/GuildApplicationCommandManager.js +3 -6
- package/src/managers/GuildBanManager.js +52 -27
- package/src/managers/GuildChannelManager.js +54 -91
- package/src/managers/GuildEmojiManager.js +18 -108
- package/src/managers/GuildEmojiRoleManager.js +14 -24
- package/src/managers/GuildForumThreadManager.js +5 -10
- package/src/managers/GuildInviteManager.js +27 -51
- package/src/managers/GuildManager.js +185 -45
- package/src/managers/GuildMemberManager.js +105 -89
- package/src/managers/GuildMemberRoleManager.js +14 -29
- package/src/managers/GuildMessageManager.js +2 -20
- package/src/managers/GuildScheduledEventManager.js +13 -31
- package/src/managers/GuildSoundboardSoundManager.js +5 -17
- package/src/managers/GuildStickerManager.js +21 -34
- package/src/managers/GuildTextThreadManager.js +5 -9
- package/src/managers/MessageManager.js +77 -64
- package/src/managers/PartialGroupDMMessageManager.js +2 -4
- package/src/managers/PermissionOverwriteManager.js +15 -26
- package/src/managers/PollAnswerVoterManager.js +2 -14
- package/src/managers/PresenceManager.js +6 -11
- package/src/managers/ReactionManager.js +6 -13
- package/src/managers/ReactionUserManager.js +4 -11
- package/src/managers/RoleManager.js +74 -76
- package/src/managers/StageInstanceManager.js +8 -18
- package/src/managers/SubscriptionManager.js +4 -9
- package/src/managers/ThreadManager.js +13 -33
- package/src/managers/ThreadMemberManager.js +34 -27
- package/src/managers/UserManager.js +34 -32
- package/src/managers/VoiceStateManager.js +4 -9
- package/src/sharding/Shard.js +40 -64
- package/src/sharding/ShardClientUtil.js +60 -60
- package/src/sharding/ShardingManager.js +30 -89
- package/src/structures/ActionRow.js +18 -6
- package/src/structures/ActionRowBuilder.js +35 -0
- package/src/structures/AnonymousGuild.js +10 -14
- package/src/structures/ApplicationCommand.js +49 -67
- package/src/structures/ApplicationEmoji.js +5 -22
- package/src/structures/ApplicationRoleConnectionMetadata.js +0 -6
- package/src/structures/Attachment.js +7 -25
- package/src/structures/AttachmentBuilder.js +111 -0
- package/src/structures/AutoModerationActionExecution.js +2 -17
- package/src/structures/AutoModerationRule.js +17 -46
- package/src/structures/AutocompleteInteraction.js +4 -14
- package/src/structures/Base.js +2 -4
- package/src/structures/BaseChannel.js +4 -21
- package/src/structures/BaseGuild.js +7 -19
- package/src/structures/BaseGuildEmoji.js +13 -13
- package/src/structures/BaseGuildTextChannel.js +16 -45
- package/src/structures/BaseGuildVoiceChannel.js +12 -43
- package/src/structures/BaseInteraction.js +25 -54
- package/src/structures/BaseSelectMenuComponent.js +2 -8
- package/src/structures/ButtonBuilder.js +44 -0
- package/src/structures/ButtonComponent.js +2 -9
- package/src/structures/ButtonInteraction.js +2 -3
- package/src/structures/CategoryChannel.js +3 -8
- package/src/structures/ChannelSelectMenuBuilder.js +31 -0
- package/src/structures/ChannelSelectMenuComponent.js +2 -4
- package/src/structures/ChannelSelectMenuInteraction.js +2 -5
- package/src/structures/ChatInputCommandInteraction.js +4 -7
- package/src/structures/ClientApplication.js +12 -60
- package/src/structures/ClientPresence.js +10 -15
- package/src/structures/ClientUser.js +19 -36
- package/src/structures/CommandInteraction.js +7 -27
- package/src/structures/CommandInteractionOptionResolver.js +8 -36
- package/src/structures/Component.js +1 -7
- package/src/structures/ContainerComponent.js +3 -9
- package/src/structures/ContextMenuCommandInteraction.js +5 -9
- package/src/structures/DMChannel.js +15 -34
- package/src/structures/DirectoryChannel.js +2 -6
- package/src/structures/Embed.js +2 -19
- package/src/structures/EmbedBuilder.js +50 -0
- package/src/structures/Emoji.js +19 -19
- package/src/structures/Entitlement.js +2 -22
- package/src/structures/FileComponent.js +3 -7
- package/src/structures/ForumChannel.js +3 -6
- package/src/structures/Guild.js +131 -187
- package/src/structures/GuildAuditLogs.js +6 -12
- package/src/structures/GuildAuditLogsEntry.js +63 -88
- package/src/structures/GuildBan.js +3 -9
- package/src/structures/GuildChannel.js +33 -68
- package/src/structures/GuildEmoji.js +7 -19
- package/src/structures/GuildMember.js +58 -107
- package/src/structures/GuildOnboarding.js +2 -9
- package/src/structures/GuildOnboardingPrompt.js +2 -12
- package/src/structures/GuildOnboardingPromptOption.js +2 -12
- package/src/structures/GuildPreview.js +21 -30
- package/src/structures/GuildPreviewEmoji.js +2 -5
- package/src/structures/GuildScheduledEvent.js +19 -59
- package/src/structures/GuildTemplate.js +45 -24
- package/src/structures/Integration.js +7 -30
- package/src/structures/IntegrationApplication.js +12 -9
- package/src/structures/InteractionCallback.js +1 -10
- package/src/structures/InteractionCallbackResource.js +2 -7
- package/src/structures/InteractionCallbackResponse.js +3 -6
- package/src/structures/InteractionCollector.js +36 -23
- package/src/structures/InteractionResponse.js +102 -0
- package/src/structures/InteractionWebhook.js +6 -14
- package/src/structures/Invite.js +341 -0
- package/src/structures/InviteGuild.js +4 -6
- package/src/structures/InviteStageInstance.js +87 -0
- package/src/structures/LabelComponent.js +3 -3
- package/src/structures/MediaChannel.js +2 -3
- package/src/structures/MediaGalleryComponent.js +3 -6
- package/src/structures/MediaGalleryItem.js +2 -7
- package/src/structures/MentionableSelectMenuBuilder.js +32 -0
- package/src/structures/MentionableSelectMenuComponent.js +2 -3
- package/src/structures/MentionableSelectMenuInteraction.js +3 -8
- package/src/structures/Message.js +100 -169
- package/src/structures/MessageCollector.js +5 -16
- package/src/structures/MessageComponentInteraction.js +14 -34
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -4
- package/src/structures/MessageMentions.js +4 -30
- package/src/structures/MessagePayload.js +90 -92
- package/src/structures/MessageReaction.js +17 -31
- package/src/structures/ModalBuilder.js +36 -0
- package/src/structures/{ModalComponentResolver.js → ModalSubmitFields.js} +31 -37
- package/src/structures/ModalSubmitInteraction.js +55 -54
- package/src/structures/NewsChannel.js +32 -0
- package/src/structures/OAuth2Guild.js +3 -6
- package/src/structures/PartialGroupDMChannel.js +11 -23
- package/src/structures/PermissionOverwrites.js +25 -47
- package/src/structures/Poll.js +4 -19
- package/src/structures/PollAnswer.js +29 -13
- package/src/structures/Presence.js +13 -57
- package/src/structures/PrimaryEntryPointCommandInteraction.js +2 -3
- package/src/structures/ReactionCollector.js +4 -21
- package/src/structures/ReactionEmoji.js +3 -5
- package/src/structures/Role.js +48 -65
- package/src/structures/RoleSelectMenuBuilder.js +31 -0
- package/src/structures/RoleSelectMenuComponent.js +2 -3
- package/src/structures/RoleSelectMenuInteraction.js +2 -5
- package/src/structures/SKU.js +2 -9
- package/src/structures/SectionComponent.js +3 -7
- package/src/structures/SelectMenuBuilder.js +26 -0
- package/src/structures/SelectMenuComponent.js +26 -0
- package/src/structures/SelectMenuInteraction.js +26 -0
- package/src/structures/SelectMenuOptionBuilder.js +26 -0
- package/src/structures/SeparatorComponent.js +2 -5
- package/src/structures/SoundboardSound.js +2 -18
- package/src/structures/StageChannel.js +4 -13
- package/src/structures/StageInstance.js +16 -19
- package/src/structures/Sticker.js +4 -28
- package/src/structures/StickerPack.js +4 -16
- package/src/structures/StringSelectMenuBuilder.js +79 -0
- package/src/structures/StringSelectMenuComponent.js +2 -4
- package/src/structures/StringSelectMenuInteraction.js +2 -4
- package/src/structures/StringSelectMenuOptionBuilder.js +49 -0
- package/src/structures/Subscription.js +1 -15
- package/src/structures/Team.js +7 -16
- package/src/structures/TeamMember.js +15 -9
- package/src/structures/TextChannel.js +3 -6
- package/src/structures/TextDisplayComponent.js +2 -4
- package/src/structures/TextInputBuilder.js +31 -0
- package/src/structures/TextInputComponent.js +2 -5
- package/src/structures/ThreadChannel.js +35 -85
- package/src/structures/ThreadMember.js +12 -17
- package/src/structures/ThreadOnlyChannel.js +15 -36
- package/src/structures/ThumbnailComponent.js +3 -8
- package/src/structures/Typing.js +2 -10
- package/src/structures/UnfurledMediaItem.js +2 -5
- package/src/structures/User.js +68 -60
- package/src/structures/UserContextMenuCommandInteraction.js +2 -5
- package/src/structures/UserSelectMenuBuilder.js +31 -0
- package/src/structures/UserSelectMenuComponent.js +2 -3
- package/src/structures/UserSelectMenuInteraction.js +3 -7
- package/src/structures/VoiceChannel.js +4 -11
- package/src/structures/VoiceChannelEffect.js +2 -12
- package/src/structures/VoiceRegion.js +2 -7
- package/src/structures/VoiceState.js +10 -36
- package/src/structures/Webhook.js +37 -65
- package/src/structures/WelcomeChannel.js +5 -12
- package/src/structures/WelcomeScreen.js +3 -8
- package/src/structures/Widget.js +3 -13
- package/src/structures/WidgetMember.js +2 -17
- package/src/structures/interfaces/Application.js +10 -19
- package/src/structures/interfaces/Collector.js +12 -45
- package/src/structures/interfaces/InteractionResponses.js +152 -43
- package/src/structures/interfaces/TextBasedChannel.js +99 -83
- package/src/util/APITypes.js +16 -30
- package/src/util/ActivityFlagsBitField.js +2 -5
- package/src/util/ApplicationFlagsBitField.js +6 -11
- package/src/util/AttachmentFlagsBitField.js +2 -5
- package/src/util/BitField.js +8 -27
- package/src/util/ChannelFlagsBitField.js +6 -11
- package/src/util/Channels.js +61 -73
- package/src/util/Colors.js +43 -43
- package/src/util/Components.js +82 -61
- package/src/util/Constants.js +124 -94
- package/src/util/DataResolver.js +17 -36
- package/src/util/Enums.js +1 -2
- package/src/util/Events.js +14 -3
- package/src/util/Formatters.js +413 -0
- package/src/util/GuildMemberFlagsBitField.js +5 -9
- package/src/util/IntentsBitField.js +6 -10
- package/src/util/InviteFlagsBitField.js +1 -2
- package/src/util/LimitedCollection.js +6 -13
- package/src/util/LolkaSnowflake.js +14 -1
- package/src/util/MessageFlagsBitField.js +6 -11
- package/src/util/Options.js +57 -35
- package/src/util/Partials.js +4 -5
- package/src/util/PermissionsBitField.js +8 -21
- package/src/util/RoleFlagsBitField.js +2 -5
- package/src/util/SKUFlagsBitField.js +1 -4
- package/src/util/ShardEvents.js +3 -1
- package/src/util/Status.js +21 -5
- package/src/util/Sweepers.js +13 -59
- package/src/util/SystemChannelFlagsBitField.js +6 -11
- package/src/util/ThreadMemberFlagsBitField.js +2 -6
- package/src/util/Transformers.js +18 -17
- package/src/util/UserFlagsBitField.js +2 -6
- package/src/util/Util.js +97 -148
- package/src/util/WebSocketShardEvents.js +25 -0
- package/typings/index.d.mts +2392 -1768
- package/typings/index.d.ts +2392 -1768
- package/typings/rawDataTypes.d.ts +211 -0
- package/src/structures/ActivityInstance.js +0 -52
- package/src/structures/ActivityLocation.js +0 -65
- package/src/structures/AnnouncementChannel.js +0 -29
- package/src/structures/AuthorizingIntegrationOwners.js +0 -64
- package/src/structures/BaseInvite.js +0 -187
- package/src/structures/GroupDMInvite.js +0 -37
- package/src/structures/GuildInvite.js +0 -223
- package/src/util/Invites.js +0 -31
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { basename, flatten } = require('../util/Util
|
|
3
|
+
const AttachmentFlagsBitField = require('../util/AttachmentFlagsBitField.js');
|
|
4
|
+
const { basename, flatten } = require('../util/Util');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} AttachmentPayload
|
|
8
|
+
* @property {?string} name The name of the attachment
|
|
8
9
|
* @property {Stream|BufferResolvable} attachment The attachment in this payload
|
|
9
|
-
* @property {string}
|
|
10
|
-
* @property {string} [description] The description of the attachment
|
|
11
|
-
* @property {title} [title] The title of the attachment
|
|
12
|
-
* @property {string} [waveform] The base64 encoded byte array representing a sampled waveform (from voice message attachments)
|
|
13
|
-
* @property {number} [duration] The duration of the attachment in seconds (from voice message attachments)
|
|
10
|
+
* @property {?string} description The description of the attachment
|
|
14
11
|
*/
|
|
15
12
|
|
|
16
13
|
/**
|
|
@@ -21,7 +18,6 @@ class Attachment {
|
|
|
21
18
|
this.attachment = data.url;
|
|
22
19
|
/**
|
|
23
20
|
* The name of this attachment
|
|
24
|
-
*
|
|
25
21
|
* @type {string}
|
|
26
22
|
*/
|
|
27
23
|
this.name = data.filename;
|
|
@@ -31,7 +27,6 @@ class Attachment {
|
|
|
31
27
|
_patch(data) {
|
|
32
28
|
/**
|
|
33
29
|
* The attachment's id
|
|
34
|
-
*
|
|
35
30
|
* @type {Snowflake}
|
|
36
31
|
*/
|
|
37
32
|
this.id = data.id;
|
|
@@ -39,7 +34,6 @@ class Attachment {
|
|
|
39
34
|
if ('size' in data) {
|
|
40
35
|
/**
|
|
41
36
|
* The size of this attachment in bytes
|
|
42
|
-
*
|
|
43
37
|
* @type {number}
|
|
44
38
|
*/
|
|
45
39
|
this.size = data.size;
|
|
@@ -48,7 +42,6 @@ class Attachment {
|
|
|
48
42
|
if ('url' in data) {
|
|
49
43
|
/**
|
|
50
44
|
* The URL to this attachment
|
|
51
|
-
*
|
|
52
45
|
* @type {string}
|
|
53
46
|
*/
|
|
54
47
|
this.url = data.url;
|
|
@@ -57,7 +50,6 @@ class Attachment {
|
|
|
57
50
|
if ('proxy_url' in data) {
|
|
58
51
|
/**
|
|
59
52
|
* The Proxy URL to this attachment
|
|
60
|
-
*
|
|
61
53
|
* @type {string}
|
|
62
54
|
*/
|
|
63
55
|
this.proxyURL = data.proxy_url;
|
|
@@ -66,7 +58,6 @@ class Attachment {
|
|
|
66
58
|
if ('height' in data) {
|
|
67
59
|
/**
|
|
68
60
|
* The height of this attachment (if an image or video)
|
|
69
|
-
*
|
|
70
61
|
* @type {?number}
|
|
71
62
|
*/
|
|
72
63
|
this.height = data.height;
|
|
@@ -77,7 +68,6 @@ class Attachment {
|
|
|
77
68
|
if ('width' in data) {
|
|
78
69
|
/**
|
|
79
70
|
* The width of this attachment (if an image or video)
|
|
80
|
-
*
|
|
81
71
|
* @type {?number}
|
|
82
72
|
*/
|
|
83
73
|
this.width = data.width;
|
|
@@ -88,7 +78,6 @@ class Attachment {
|
|
|
88
78
|
if ('content_type' in data) {
|
|
89
79
|
/**
|
|
90
80
|
* The media (MIME) type of this attachment
|
|
91
|
-
*
|
|
92
81
|
* @type {?string}
|
|
93
82
|
* @see {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types}
|
|
94
83
|
*/
|
|
@@ -100,7 +89,6 @@ class Attachment {
|
|
|
100
89
|
if ('description' in data) {
|
|
101
90
|
/**
|
|
102
91
|
* The description (alt text) of this attachment
|
|
103
|
-
*
|
|
104
92
|
* @type {?string}
|
|
105
93
|
*/
|
|
106
94
|
this.description = data.description;
|
|
@@ -110,7 +98,6 @@ class Attachment {
|
|
|
110
98
|
|
|
111
99
|
/**
|
|
112
100
|
* Whether this attachment is ephemeral
|
|
113
|
-
*
|
|
114
101
|
* @type {boolean}
|
|
115
102
|
*/
|
|
116
103
|
this.ephemeral = data.ephemeral ?? false;
|
|
@@ -118,8 +105,7 @@ class Attachment {
|
|
|
118
105
|
if ('duration_secs' in data) {
|
|
119
106
|
/**
|
|
120
107
|
* The duration of this attachment in seconds
|
|
121
|
-
* <info>This will only be available if the attachment is
|
|
122
|
-
*
|
|
108
|
+
* <info>This will only be available if the attachment is an audio file.</info>
|
|
123
109
|
* @type {?number}
|
|
124
110
|
*/
|
|
125
111
|
this.duration = data.duration_secs;
|
|
@@ -130,8 +116,7 @@ class Attachment {
|
|
|
130
116
|
if ('waveform' in data) {
|
|
131
117
|
/**
|
|
132
118
|
* The base64 encoded byte array representing a sampled waveform
|
|
133
|
-
* <info>This will only be available if
|
|
134
|
-
*
|
|
119
|
+
* <info>This will only be available if the attachment is an audio file.</info>
|
|
135
120
|
* @type {?string}
|
|
136
121
|
*/
|
|
137
122
|
this.waveform = data.waveform;
|
|
@@ -142,7 +127,6 @@ class Attachment {
|
|
|
142
127
|
if ('flags' in data) {
|
|
143
128
|
/**
|
|
144
129
|
* The flags of this attachment
|
|
145
|
-
*
|
|
146
130
|
* @type {Readonly<AttachmentFlagsBitField>}
|
|
147
131
|
*/
|
|
148
132
|
this.flags = new AttachmentFlagsBitField(data.flags).freeze();
|
|
@@ -154,7 +138,6 @@ class Attachment {
|
|
|
154
138
|
/**
|
|
155
139
|
* The title of this attachment
|
|
156
140
|
* <info>This will only be available if the attachment name contains special characters.</info>
|
|
157
|
-
*
|
|
158
141
|
* @type {?string}
|
|
159
142
|
*/
|
|
160
143
|
this.title = data.title;
|
|
@@ -165,7 +148,6 @@ class Attachment {
|
|
|
165
148
|
|
|
166
149
|
/**
|
|
167
150
|
* Whether or not this attachment has been marked as a spoiler
|
|
168
|
-
*
|
|
169
151
|
* @type {boolean}
|
|
170
152
|
* @readonly
|
|
171
153
|
*/
|
|
@@ -178,4 +160,4 @@ class Attachment {
|
|
|
178
160
|
}
|
|
179
161
|
}
|
|
180
162
|
|
|
181
|
-
exports
|
|
163
|
+
module.exports = Attachment;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { basename, flatten } = require('../util/Util');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents an attachment builder
|
|
7
|
+
*/
|
|
8
|
+
class AttachmentBuilder {
|
|
9
|
+
/**
|
|
10
|
+
* @param {BufferResolvable|Stream} attachment The file
|
|
11
|
+
* @param {AttachmentData} [data] Extra data
|
|
12
|
+
*/
|
|
13
|
+
constructor(attachment, data = {}) {
|
|
14
|
+
/**
|
|
15
|
+
* The file associated with this attachment.
|
|
16
|
+
* @type {BufferResolvable|Stream}
|
|
17
|
+
*/
|
|
18
|
+
this.attachment = attachment;
|
|
19
|
+
/**
|
|
20
|
+
* The name of this attachment
|
|
21
|
+
* @type {?string}
|
|
22
|
+
*/
|
|
23
|
+
this.name = data.name;
|
|
24
|
+
/**
|
|
25
|
+
* The description of the attachment
|
|
26
|
+
* @type {?string}
|
|
27
|
+
*/
|
|
28
|
+
this.description = data.description;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Sets the description of this attachment.
|
|
33
|
+
* @param {string} description The description of the file
|
|
34
|
+
* @returns {AttachmentBuilder} This attachment
|
|
35
|
+
*/
|
|
36
|
+
setDescription(description) {
|
|
37
|
+
this.description = description;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Sets the file of this attachment.
|
|
43
|
+
* @param {BufferResolvable|Stream} attachment The file
|
|
44
|
+
* @returns {AttachmentBuilder} This attachment
|
|
45
|
+
*/
|
|
46
|
+
setFile(attachment) {
|
|
47
|
+
this.attachment = attachment;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sets the name of this attachment.
|
|
53
|
+
* @param {string} name The name of the file
|
|
54
|
+
* @returns {AttachmentBuilder} This attachment
|
|
55
|
+
*/
|
|
56
|
+
setName(name) {
|
|
57
|
+
this.name = name;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sets whether this attachment is a spoiler
|
|
63
|
+
* @param {boolean} [spoiler=true] Whether the attachment should be marked as a spoiler
|
|
64
|
+
* @returns {AttachmentBuilder} This attachment
|
|
65
|
+
*/
|
|
66
|
+
setSpoiler(spoiler = true) {
|
|
67
|
+
if (spoiler === this.spoiler) return this;
|
|
68
|
+
|
|
69
|
+
if (!spoiler) {
|
|
70
|
+
while (this.spoiler) {
|
|
71
|
+
this.name = this.name.slice('SPOILER_'.length);
|
|
72
|
+
}
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
this.name = `SPOILER_${this.name}`;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether or not this attachment has been marked as a spoiler
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
* @readonly
|
|
83
|
+
*/
|
|
84
|
+
get spoiler() {
|
|
85
|
+
return basename(this.name).startsWith('SPOILER_');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
toJSON() {
|
|
89
|
+
return flatten(this);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Makes a new builder instance from a preexisting attachment structure.
|
|
94
|
+
* @param {AttachmentBuilder|Attachment|AttachmentPayload} other The builder to construct a new instance from
|
|
95
|
+
* @returns {AttachmentBuilder}
|
|
96
|
+
*/
|
|
97
|
+
static from(other) {
|
|
98
|
+
return new AttachmentBuilder(other.attachment, {
|
|
99
|
+
name: other.name,
|
|
100
|
+
description: other.description,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = AttachmentBuilder;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @typedef {Object} AttachmentData
|
|
109
|
+
* @property {string} [name] The name of the attachment
|
|
110
|
+
* @property {string} [description] The description of the attachment
|
|
111
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { _transformAPIAutoModerationAction } = require('../util/Transformers
|
|
3
|
+
const { _transformAPIAutoModerationAction } = require('../util/Transformers');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents the structure of an executed action when an {@link AutoModerationRule} is triggered.
|
|
@@ -9,42 +9,36 @@ class AutoModerationActionExecution {
|
|
|
9
9
|
constructor(data, guild) {
|
|
10
10
|
/**
|
|
11
11
|
* The guild where this action was executed from.
|
|
12
|
-
*
|
|
13
12
|
* @type {Guild}
|
|
14
13
|
*/
|
|
15
14
|
this.guild = guild;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* The action that was executed.
|
|
19
|
-
*
|
|
20
18
|
* @type {AutoModerationAction}
|
|
21
19
|
*/
|
|
22
20
|
this.action = _transformAPIAutoModerationAction(data.action);
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* The id of the auto moderation rule this action belongs to.
|
|
26
|
-
*
|
|
27
24
|
* @type {Snowflake}
|
|
28
25
|
*/
|
|
29
26
|
this.ruleId = data.rule_id;
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
29
|
* The trigger type of the auto moderation rule which was triggered.
|
|
33
|
-
*
|
|
34
30
|
* @type {AutoModerationRuleTriggerType}
|
|
35
31
|
*/
|
|
36
32
|
this.ruleTriggerType = data.rule_trigger_type;
|
|
37
33
|
|
|
38
34
|
/**
|
|
39
35
|
* The id of the user that triggered this action.
|
|
40
|
-
*
|
|
41
36
|
* @type {Snowflake}
|
|
42
37
|
*/
|
|
43
38
|
this.userId = data.user_id;
|
|
44
39
|
|
|
45
40
|
/**
|
|
46
41
|
* The id of the channel where this action was triggered from.
|
|
47
|
-
*
|
|
48
42
|
* @type {?Snowflake}
|
|
49
43
|
*/
|
|
50
44
|
this.channelId = data.channel_id ?? null;
|
|
@@ -52,14 +46,12 @@ class AutoModerationActionExecution {
|
|
|
52
46
|
/**
|
|
53
47
|
* The id of the message that triggered this action.
|
|
54
48
|
* <info>This will not be present if the message was blocked or the content was not part of any message.</info>
|
|
55
|
-
*
|
|
56
49
|
* @type {?Snowflake}
|
|
57
50
|
*/
|
|
58
51
|
this.messageId = data.message_id ?? null;
|
|
59
52
|
|
|
60
53
|
/**
|
|
61
54
|
* The id of any system auto moderation messages posted as a result of this action.
|
|
62
|
-
*
|
|
63
55
|
* @type {?Snowflake}
|
|
64
56
|
*/
|
|
65
57
|
this.alertSystemMessageId = data.alert_system_message_id ?? null;
|
|
@@ -67,21 +59,18 @@ class AutoModerationActionExecution {
|
|
|
67
59
|
/**
|
|
68
60
|
* The content that triggered this action.
|
|
69
61
|
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged gateway intent.</info>
|
|
70
|
-
*
|
|
71
62
|
* @type {string}
|
|
72
63
|
*/
|
|
73
64
|
this.content = data.content;
|
|
74
65
|
|
|
75
66
|
/**
|
|
76
67
|
* The word or phrase configured in the rule that triggered this action.
|
|
77
|
-
*
|
|
78
68
|
* @type {?string}
|
|
79
69
|
*/
|
|
80
70
|
this.matchedKeyword = data.matched_keyword ?? null;
|
|
81
71
|
|
|
82
72
|
/**
|
|
83
73
|
* The substring in content that triggered this action.
|
|
84
|
-
*
|
|
85
74
|
* @type {?string}
|
|
86
75
|
*/
|
|
87
76
|
this.matchedContent = data.matched_content ?? null;
|
|
@@ -89,7 +78,6 @@ class AutoModerationActionExecution {
|
|
|
89
78
|
|
|
90
79
|
/**
|
|
91
80
|
* The auto moderation rule this action belongs to.
|
|
92
|
-
*
|
|
93
81
|
* @type {?AutoModerationRule}
|
|
94
82
|
* @readonly
|
|
95
83
|
*/
|
|
@@ -99,7 +87,6 @@ class AutoModerationActionExecution {
|
|
|
99
87
|
|
|
100
88
|
/**
|
|
101
89
|
* The channel where this action was triggered from.
|
|
102
|
-
*
|
|
103
90
|
* @type {?(GuildTextBasedChannel|ForumChannel|MediaChannel)}
|
|
104
91
|
* @readonly
|
|
105
92
|
*/
|
|
@@ -109,7 +96,6 @@ class AutoModerationActionExecution {
|
|
|
109
96
|
|
|
110
97
|
/**
|
|
111
98
|
* The user that triggered this action.
|
|
112
|
-
*
|
|
113
99
|
* @type {?User}
|
|
114
100
|
* @readonly
|
|
115
101
|
*/
|
|
@@ -119,7 +105,6 @@ class AutoModerationActionExecution {
|
|
|
119
105
|
|
|
120
106
|
/**
|
|
121
107
|
* The guild member that triggered this action.
|
|
122
|
-
*
|
|
123
108
|
* @type {?GuildMember}
|
|
124
109
|
* @readonly
|
|
125
110
|
*/
|
|
@@ -128,4 +113,4 @@ class AutoModerationActionExecution {
|
|
|
128
113
|
}
|
|
129
114
|
}
|
|
130
115
|
|
|
131
|
-
exports
|
|
116
|
+
module.exports = AutoModerationActionExecution;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
|
-
const
|
|
5
|
-
const {
|
|
4
|
+
const Base = require('./Base');
|
|
5
|
+
const { _transformAPIAutoModerationAction } = require('../util/Transformers');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents an auto moderation rule.
|
|
9
|
-
*
|
|
10
9
|
* @extends {Base}
|
|
11
10
|
*/
|
|
12
11
|
class AutoModerationRule extends Base {
|
|
@@ -15,28 +14,24 @@ class AutoModerationRule extends Base {
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* The id of this auto moderation rule.
|
|
18
|
-
*
|
|
19
17
|
* @type {Snowflake}
|
|
20
18
|
*/
|
|
21
19
|
this.id = data.id;
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* The guild this auto moderation rule is for.
|
|
25
|
-
*
|
|
26
23
|
* @type {Guild}
|
|
27
24
|
*/
|
|
28
25
|
this.guild = guild;
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* The user that created this auto moderation rule.
|
|
32
|
-
*
|
|
33
29
|
* @type {Snowflake}
|
|
34
30
|
*/
|
|
35
31
|
this.creatorId = data.creator_id;
|
|
36
32
|
|
|
37
33
|
/**
|
|
38
34
|
* The trigger type of this auto moderation rule.
|
|
39
|
-
*
|
|
40
35
|
* @type {AutoModerationRuleTriggerType}
|
|
41
36
|
*/
|
|
42
37
|
this.triggerType = data.trigger_type;
|
|
@@ -48,7 +43,6 @@ class AutoModerationRule extends Base {
|
|
|
48
43
|
if ('name' in data) {
|
|
49
44
|
/**
|
|
50
45
|
* The name of this auto moderation rule.
|
|
51
|
-
*
|
|
52
46
|
* @type {string}
|
|
53
47
|
*/
|
|
54
48
|
this.name = data.name;
|
|
@@ -57,7 +51,6 @@ class AutoModerationRule extends Base {
|
|
|
57
51
|
if ('event_type' in data) {
|
|
58
52
|
/**
|
|
59
53
|
* The event type of this auto moderation rule.
|
|
60
|
-
*
|
|
61
54
|
* @type {AutoModerationRuleEventType}
|
|
62
55
|
*/
|
|
63
56
|
this.eventType = data.event_type;
|
|
@@ -66,7 +59,6 @@ class AutoModerationRule extends Base {
|
|
|
66
59
|
if ('trigger_metadata' in data) {
|
|
67
60
|
/**
|
|
68
61
|
* Additional data used to determine whether an auto moderation rule should be triggered.
|
|
69
|
-
*
|
|
70
62
|
* @typedef {Object} AutoModerationTriggerMetadata
|
|
71
63
|
* @property {string[]} keywordFilter The substrings that will be searched for in the content
|
|
72
64
|
* @property {string[]} regexPatterns The regular expression patterns which will be matched against the content
|
|
@@ -83,7 +75,6 @@ class AutoModerationRule extends Base {
|
|
|
83
75
|
|
|
84
76
|
/**
|
|
85
77
|
* The trigger metadata of the rule.
|
|
86
|
-
*
|
|
87
78
|
* @type {AutoModerationTriggerMetadata}
|
|
88
79
|
*/
|
|
89
80
|
this.triggerMetadata = {
|
|
@@ -99,7 +90,6 @@ class AutoModerationRule extends Base {
|
|
|
99
90
|
if ('actions' in data) {
|
|
100
91
|
/**
|
|
101
92
|
* An object containing information about an auto moderation rule action.
|
|
102
|
-
*
|
|
103
93
|
* @typedef {Object} AutoModerationAction
|
|
104
94
|
* @property {AutoModerationActionType} type The type of this auto moderation rule action
|
|
105
95
|
* @property {AutoModerationActionMetadata} metadata Additional metadata needed during execution
|
|
@@ -107,7 +97,6 @@ class AutoModerationRule extends Base {
|
|
|
107
97
|
|
|
108
98
|
/**
|
|
109
99
|
* Additional data used when an auto moderation rule is executed.
|
|
110
|
-
*
|
|
111
100
|
* @typedef {Object} AutoModerationActionMetadata
|
|
112
101
|
* @property {?Snowflake} channelId The id of the channel to which content will be logged
|
|
113
102
|
* @property {?number} durationSeconds The timeout duration in seconds
|
|
@@ -116,7 +105,6 @@ class AutoModerationRule extends Base {
|
|
|
116
105
|
|
|
117
106
|
/**
|
|
118
107
|
* The actions of this auto moderation rule.
|
|
119
|
-
*
|
|
120
108
|
* @type {AutoModerationAction[]}
|
|
121
109
|
*/
|
|
122
110
|
this.actions = data.actions.map(action => _transformAPIAutoModerationAction(action));
|
|
@@ -125,7 +113,6 @@ class AutoModerationRule extends Base {
|
|
|
125
113
|
if ('enabled' in data) {
|
|
126
114
|
/**
|
|
127
115
|
* Whether this auto moderation rule is enabled.
|
|
128
|
-
*
|
|
129
116
|
* @type {boolean}
|
|
130
117
|
*/
|
|
131
118
|
this.enabled = data.enabled;
|
|
@@ -134,7 +121,6 @@ class AutoModerationRule extends Base {
|
|
|
134
121
|
if ('exempt_roles' in data) {
|
|
135
122
|
/**
|
|
136
123
|
* The roles exempt by this auto moderation rule.
|
|
137
|
-
*
|
|
138
124
|
* @type {Collection<Snowflake, Role>}
|
|
139
125
|
*/
|
|
140
126
|
this.exemptRoles = new Collection(
|
|
@@ -145,7 +131,6 @@ class AutoModerationRule extends Base {
|
|
|
145
131
|
if ('exempt_channels' in data) {
|
|
146
132
|
/**
|
|
147
133
|
* The channels exempt by this auto moderation rule.
|
|
148
|
-
*
|
|
149
134
|
* @type {Collection<Snowflake, GuildChannel|ThreadChannel>}
|
|
150
135
|
*/
|
|
151
136
|
this.exemptChannels = new Collection(
|
|
@@ -156,83 +141,75 @@ class AutoModerationRule extends Base {
|
|
|
156
141
|
|
|
157
142
|
/**
|
|
158
143
|
* Edits this auto moderation rule.
|
|
159
|
-
*
|
|
160
144
|
* @param {AutoModerationRuleEditOptions} options Options for editing this auto moderation rule
|
|
161
145
|
* @returns {Promise<AutoModerationRule>}
|
|
162
146
|
*/
|
|
163
|
-
|
|
147
|
+
edit(options) {
|
|
164
148
|
return this.guild.autoModerationRules.edit(this.id, options);
|
|
165
149
|
}
|
|
166
150
|
|
|
167
151
|
/**
|
|
168
152
|
* Deletes this auto moderation rule.
|
|
169
|
-
*
|
|
170
153
|
* @param {string} [reason] The reason for deleting this auto moderation rule
|
|
171
154
|
* @returns {Promise<void>}
|
|
172
155
|
*/
|
|
173
|
-
|
|
156
|
+
delete(reason) {
|
|
174
157
|
return this.guild.autoModerationRules.delete(this.id, reason);
|
|
175
158
|
}
|
|
176
159
|
|
|
177
160
|
/**
|
|
178
161
|
* Sets the name for this auto moderation rule.
|
|
179
|
-
*
|
|
180
162
|
* @param {string} name The name of this auto moderation rule
|
|
181
163
|
* @param {string} [reason] The reason for changing the name of this auto moderation rule
|
|
182
164
|
* @returns {Promise<AutoModerationRule>}
|
|
183
165
|
*/
|
|
184
|
-
|
|
166
|
+
setName(name, reason) {
|
|
185
167
|
return this.edit({ name, reason });
|
|
186
168
|
}
|
|
187
169
|
|
|
188
170
|
/**
|
|
189
171
|
* Sets the event type for this auto moderation rule.
|
|
190
|
-
*
|
|
191
172
|
* @param {AutoModerationRuleEventType} eventType The event type of this auto moderation rule
|
|
192
173
|
* @param {string} [reason] The reason for changing the event type of this auto moderation rule
|
|
193
174
|
* @returns {Promise<AutoModerationRule>}
|
|
194
175
|
*/
|
|
195
|
-
|
|
176
|
+
setEventType(eventType, reason) {
|
|
196
177
|
return this.edit({ eventType, reason });
|
|
197
178
|
}
|
|
198
179
|
|
|
199
180
|
/**
|
|
200
181
|
* Sets the keyword filter for this auto moderation rule.
|
|
201
|
-
*
|
|
202
182
|
* @param {string[]} keywordFilter The keyword filter of this auto moderation rule
|
|
203
183
|
* @param {string} [reason] The reason for changing the keyword filter of this auto moderation rule
|
|
204
184
|
* @returns {Promise<AutoModerationRule>}
|
|
205
185
|
*/
|
|
206
|
-
|
|
186
|
+
setKeywordFilter(keywordFilter, reason) {
|
|
207
187
|
return this.edit({ triggerMetadata: { ...this.triggerMetadata, keywordFilter }, reason });
|
|
208
188
|
}
|
|
209
189
|
|
|
210
190
|
/**
|
|
211
191
|
* Sets the regular expression patterns for this auto moderation rule.
|
|
212
|
-
*
|
|
213
192
|
* @param {string[]} regexPatterns The regular expression patterns of this auto moderation rule
|
|
214
193
|
* <info>Only Rust-flavored regular expressions are supported.</info>
|
|
215
194
|
* @param {string} [reason] The reason for changing the regular expression patterns of this auto moderation rule
|
|
216
195
|
* @returns {Promise<AutoModerationRule>}
|
|
217
196
|
*/
|
|
218
|
-
|
|
197
|
+
setRegexPatterns(regexPatterns, reason) {
|
|
219
198
|
return this.edit({ triggerMetadata: { ...this.triggerMetadata, regexPatterns }, reason });
|
|
220
199
|
}
|
|
221
200
|
|
|
222
201
|
/**
|
|
223
202
|
* Sets the presets for this auto moderation rule.
|
|
224
|
-
*
|
|
225
203
|
* @param {AutoModerationRuleKeywordPresetType[]} presets The presets of this auto moderation rule
|
|
226
204
|
* @param {string} [reason] The reason for changing the presets of this auto moderation rule
|
|
227
205
|
* @returns {Promise<AutoModerationRule>}
|
|
228
206
|
*/
|
|
229
|
-
|
|
207
|
+
setPresets(presets, reason) {
|
|
230
208
|
return this.edit({ triggerMetadata: { ...this.triggerMetadata, presets }, reason });
|
|
231
209
|
}
|
|
232
210
|
|
|
233
211
|
/**
|
|
234
212
|
* Sets the allow list for this auto moderation rule.
|
|
235
|
-
*
|
|
236
213
|
* @param {string[]} allowList The substrings that will be exempt from triggering
|
|
237
214
|
* {@link AutoModerationRuleTriggerType.Keyword},
|
|
238
215
|
* {@link AutoModerationRuleTriggerType.KeywordPreset},
|
|
@@ -240,78 +217,72 @@ class AutoModerationRule extends Base {
|
|
|
240
217
|
* @param {string} [reason] The reason for changing the allow list of this auto moderation rule
|
|
241
218
|
* @returns {Promise<AutoModerationRule>}
|
|
242
219
|
*/
|
|
243
|
-
|
|
220
|
+
setAllowList(allowList, reason) {
|
|
244
221
|
return this.edit({ triggerMetadata: { ...this.triggerMetadata, allowList }, reason });
|
|
245
222
|
}
|
|
246
223
|
|
|
247
224
|
/**
|
|
248
225
|
* Sets the mention total limit for this auto moderation rule.
|
|
249
|
-
*
|
|
250
226
|
* @param {number} mentionTotalLimit The total number of unique role and user mentions allowed per message
|
|
251
227
|
* @param {string} [reason] The reason for changing the mention total limit of this auto moderation rule
|
|
252
228
|
* @returns {Promise<AutoModerationRule>}
|
|
253
229
|
*/
|
|
254
|
-
|
|
230
|
+
setMentionTotalLimit(mentionTotalLimit, reason) {
|
|
255
231
|
return this.edit({ triggerMetadata: { ...this.triggerMetadata, mentionTotalLimit }, reason });
|
|
256
232
|
}
|
|
257
233
|
|
|
258
234
|
/**
|
|
259
235
|
* Sets whether to enable mention raid protection for this auto moderation rule.
|
|
260
|
-
*
|
|
261
236
|
* @param {boolean} mentionRaidProtectionEnabled
|
|
262
237
|
* Whether to enable mention raid protection for this auto moderation rule
|
|
263
238
|
* @param {string} [reason] The reason for changing the mention raid protection of this auto moderation rule
|
|
264
239
|
* @returns {Promise<AutoModerationRule>}
|
|
265
240
|
*/
|
|
266
|
-
|
|
241
|
+
setMentionRaidProtectionEnabled(mentionRaidProtectionEnabled, reason) {
|
|
267
242
|
return this.edit({ triggerMetadata: { ...this.triggerMetadata, mentionRaidProtectionEnabled }, reason });
|
|
268
243
|
}
|
|
269
244
|
|
|
270
245
|
/**
|
|
271
246
|
* Sets the actions for this auto moderation rule.
|
|
272
|
-
*
|
|
273
247
|
* @param {AutoModerationActionOptions[]} actions The actions of this auto moderation rule
|
|
274
248
|
* @param {string} [reason] The reason for changing the actions of this auto moderation rule
|
|
275
249
|
* @returns {Promise<AutoModerationRule>}
|
|
276
250
|
*/
|
|
277
|
-
|
|
251
|
+
setActions(actions, reason) {
|
|
278
252
|
return this.edit({ actions, reason });
|
|
279
253
|
}
|
|
280
254
|
|
|
281
255
|
/**
|
|
282
256
|
* Sets whether this auto moderation rule should be enabled.
|
|
283
|
-
*
|
|
284
257
|
* @param {boolean} [enabled=true] Whether to enable this auto moderation rule
|
|
285
258
|
* @param {string} [reason] The reason for enabling or disabling this auto moderation rule
|
|
286
259
|
* @returns {Promise<AutoModerationRule>}
|
|
287
260
|
*/
|
|
288
|
-
|
|
261
|
+
setEnabled(enabled = true, reason) {
|
|
289
262
|
return this.edit({ enabled, reason });
|
|
290
263
|
}
|
|
291
264
|
|
|
292
265
|
/**
|
|
293
266
|
* Sets the exempt roles for this auto moderation rule.
|
|
294
|
-
*
|
|
295
267
|
* @param {Collection<Snowflake, Role>|RoleResolvable[]} [exemptRoles]
|
|
296
268
|
* The roles that should not be affected by the auto moderation rule
|
|
297
269
|
* @param {string} [reason] The reason for changing the exempt roles of this auto moderation rule
|
|
298
270
|
* @returns {Promise<AutoModerationRule>}
|
|
299
271
|
*/
|
|
300
|
-
|
|
272
|
+
setExemptRoles(exemptRoles, reason) {
|
|
301
273
|
return this.edit({ exemptRoles, reason });
|
|
302
274
|
}
|
|
303
275
|
|
|
304
276
|
/**
|
|
305
277
|
* Sets the exempt channels for this auto moderation rule.
|
|
306
|
-
*
|
|
307
278
|
* @param {Collection<Snowflake, GuildChannel|ThreadChannel>|GuildChannelResolvable[]} [exemptChannels]
|
|
308
279
|
* The channels that should not be affected by the auto moderation rule
|
|
309
280
|
* @param {string} [reason] The reason for changing the exempt channels of this auto moderation rule
|
|
310
281
|
* @returns {Promise<AutoModerationRule>}
|
|
311
282
|
*/
|
|
312
|
-
|
|
283
|
+
setExemptChannels(exemptChannels, reason) {
|
|
313
284
|
return this.edit({ exemptChannels, reason });
|
|
314
285
|
}
|
|
315
286
|
}
|
|
316
287
|
|
|
317
|
-
exports
|
|
288
|
+
module.exports = AutoModerationRule;
|