AutoModManager
AutoModManager ⇐ Base
Section titled “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
- AutoModManager ⇐
Base- new AutoModManager(client)
- instance
- .cache ⇒
- ._add(rules, [guildId], [options]) ⇒
Rule|null - .fetch(rule, [options]) ⇒
Promise.<object> - ._fetchId(rule, [cache], [force]) ⇒
Promise.<any> - .create([options]) ⇒
Promise - .edit(rule, [options]) ⇒
Promise.<Rule> - .delete(rule, reason) ⇒
Promise.<Rule>
- static
- .transformPayload(payload) ⇒
Object - .transformActions(actions) ⇒
Object - .transformMetadata(metadata) ⇒
Object
- .transformPayload(payload) ⇒
new AutoModManager(client)
Section titled “new AutoModManager(client)”Constructs a new instance of the class.
| Param | Type | Description |
|---|---|---|
| client | Client | The client object used for communication with the server. |
autoModManager.cache ⇒
Section titled “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
Section titled “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
| Param | Type | Default | Description |
|---|---|---|---|
| rules | string | Rule | The 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] | boolean | true | Whether to cache the added rule. |
| [options.force] | boolean | false | Whether to force adding the rule even if it already exists in the cache. |
autoModManager.fetch(rule, [options]) ⇒ Promise.<object>
Section titled “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.
| Param | Type | Default | Description |
|---|---|---|---|
| rule | string | object | The rule ID or an object containing the rule details. | |
| [options] | object | Additional options for the fetch request. | |
| [options.cache] | boolean | true | Whether to cache the fetched rules. |
| [options.force] | boolean | false | Whether to force the fetch request even if the rules are already cached. |
autoModManager._fetchId(rule, [cache], [force]) ⇒ Promise.<any>
Section titled “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.
| Param | Type | Default | Description |
|---|---|---|---|
| rule | string | Object | The rule ID or an object containing the rule ID. | |
| [cache] | boolean | true | Whether to cache the fetched rule. |
| [force] | boolean | false | Whether to force fetching the rule even if it is already cached. |
autoModManager.create([options]) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| [options] | Object | The options for creating the rule. |
| [options.reason] | string | The reason for creating the rule. |
autoModManager.edit(rule, [options]) ⇒ Promise.<Rule>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| rule | string | Rule | The ID or the rule object to edit. |
| [options] | Object | Additional options for the edit operation. |
| [options.reason] | string | The reason for the edit. |
autoModManager.delete(rule, reason) ⇒ Promise.<Rule>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| rule | string | Rule | The ID or the rule object to delete. |
| reason | string | The reason for deleting the rule. |
AutoModManager.transformPayload(payload) ⇒ Object
Section titled “AutoModManager.transformPayload(payload) ⇒ Object”Transforms the payload object into a new format.
Kind: static method of AutoModManager
Returns: Object - - The transformed payload object.
| Param | Type | Description |
|---|---|---|
| payload | Object | The payload object to transform. |
AutoModManager.transformActions(actions) ⇒ Object
Section titled “AutoModManager.transformActions(actions) ⇒ Object”Transforms the actions object into a new format.
Kind: static method of AutoModManager
Returns: Object - - The transformed actions object.
| Param | Type | Description |
|---|---|---|
| actions | Object | The actions object to transform. |
AutoModManager.transformMetadata(metadata) ⇒ Object
Section titled “AutoModManager.transformMetadata(metadata) ⇒ Object”Transforms the given metadata object into a new format.
Kind: static method of AutoModManager
Returns: Object - - The transformed metadata object.
| Param | Type | Description |
|---|---|---|
| metadata | Object | The metadata object to transform. |