Skip to content

AutoModManager

AutoModManager ⇐ Base

Represents an AutoMod manager that handles the creation, editing, and deletion of auto-moderation rules for a guild.

Kind: global class
Extends: Base

new AutoModManager(client)

Constructs a new instance of the class.

ParamTypeDescription
clientClientThe client object used for communication with the server.

autoModManager.cache ⇒

Getter method for the cache property.

Kind: instance property of AutoModManager
Returns: The Collection object representing the cache.

autoModManager._add(rules, [guildId], [options]) ⇒ Rule | null

Adds a rule to the guild’s auto moderation system.

Kind: instance method of AutoModManager
Returns: Rule | null - The added rule, or null if

ParamTypeDefaultDescription
rulesstring | RuleThe rule to add. Can be either a rule ID or a Rule object.
[guildId]string”this.guildId”The ID of the guild to add the rule to.
[options]object{cache: true, force: false}Additional options for adding the rule.
[options.cache]booleantrueWhether to cache the added rule.
[options.force]booleanfalseWhether to force adding the rule even if it already exists in the cache.

autoModManager.fetch(rule, [options]) ⇒ Promise.<object>

Fetches auto-moderation rules from the server based on the provided rule and options.

Kind: instance method of AutoModManager
Returns: Promise.<object> - - A promise that resolves to the fetched auto-moderation rules.

ParamTypeDefaultDescription
rulestring | objectThe rule ID or an object containing the rule details.
[options]objectAdditional options for the fetch request.
[options.cache]booleantrueWhether to cache the fetched rules.
[options.force]booleanfalseWhether to force the fetch request even if the rules are already cached.

autoModManager._fetchId(rule, [cache], [force]) ⇒ Promise.<any>

Fetches the ID of a rule from the auto-moderation rules in a guild.

Kind: instance method of AutoModManager
Returns: Promise.<any> - - A promise that resolves to the fetched rule.

ParamTypeDefaultDescription
rulestring | ObjectThe rule ID or an object containing the rule ID.
[cache]booleantrueWhether to cache the fetched rule.
[force]booleanfalseWhether to force fetching the rule even if it is already cached.

autoModManager.create([options]) ⇒ Promise

Creates a new auto-moderation rule for the guild.

Kind: instance method of AutoModManager
Returns: Promise - A promise that resolves with the created rule.

ParamTypeDescription
[options]ObjectThe options for creating the rule.
[options.reason]stringThe reason for creating the rule.

autoModManager.edit(rule, [options]) ⇒ Promise.<Rule>

Edits an auto-moderation rule in the guild.

Kind: instance method of AutoModManager
Returns: Promise.<Rule> - A promise that resolves with the edited rule.

ParamTypeDescription
rulestring | RuleThe ID or the rule object to edit.
[options]ObjectAdditional options for the edit operation.
[options.reason]stringThe reason for the edit.

autoModManager.delete(rule, reason) ⇒ Promise.<Rule>

Deletes an auto-moderation rule from the guild.

Kind: instance method of AutoModManager
Returns: Promise.<Rule> - - The deleted rule object.

ParamTypeDescription
rulestring | RuleThe ID or the rule object to delete.
reasonstringThe reason for deleting the rule.

AutoModManager.transformPayload(payload) ⇒ Object

Transforms the payload object into a new format.

Kind: static method of AutoModManager
Returns: Object - - The transformed payload object.

ParamTypeDescription
payloadObjectThe payload object to transform.

AutoModManager.transformActions(actions) ⇒ Object

Transforms the actions object into a new format.

Kind: static method of AutoModManager
Returns: Object - - The transformed actions object.

ParamTypeDescription
actionsObjectThe actions object to transform.

AutoModManager.transformMetadata(metadata) ⇒ Object

Transforms the given metadata object into a new format.

Kind: static method of AutoModManager
Returns: Object - - The transformed metadata object.

ParamTypeDescription
metadataObjectThe metadata object to transform.