AutoModRule

discord_http.automod module

class discord_http.automod.AutoModRule(*, state: DiscordAPI, data: dict)[source]

Bases: PartialAutoModRule

property creator: PartialUser

The user that created the automod rule in User object form

Type:

PartialUser

class discord_http.automod.AutoModRuleAction(*, type: AutoModRuleActionType, channel_id: Snowflake | int | None = None, duration_seconds: int | None = None, custom_message: str | None = None)[source]

Bases: object

classmethod create_alert_location(channel: Snowflake | int) Self[source]
classmethod create_message(message: str) Self[source]
classmethod create_timeout(seconds: int) Self[source]
classmethod from_dict(data: dict) Self[source]
to_dict() dict[source]
class discord_http.automod.AutoModRuleTriggers(*, keyword_filter: list[str] | None = None, regex_patterns: list[str] | None = None, presets: list[AutoModRulePresetType] | None = None, allow_list: list[str] | None = None, mention_total_limit: int | None = None, mention_raid_protection_enabled: bool = False)[source]

Bases: object

classmethod from_dict(data: dict) Self[source]
to_dict() dict[source]
class discord_http.automod.PartialAutoModRule(*, state: DiscordAPI, id: int, guild_id: int)[source]

Bases: PartialBase

async delete(*, reason: str | None = None) None[source]

Delete the automod rule

Parameters:

reason (str | None) – Reason for deleting the automod

async edit(*, name: str | None = <MISSING>, event_type: ~discord_http.enums.AutoModRuleEventType | int | None = <MISSING>, keyword_filter: list[str] | None = <MISSING>, regex_patterns: list[str] | None = <MISSING>, presets: list[~discord_http.enums.AutoModRulePresetType] | None = <MISSING>, allow_list: list[str] | None = <MISSING>, mention_total_limit: int | None = <MISSING>, mention_raid_protection_enabled: bool = <MISSING>, alert_channel: ~discord_http.object.Snowflake | int | None = <MISSING>, timeout_seconds: int | None = <MISSING>, message: str | None = <MISSING>, enabled: bool = <MISSING>, exempt_roles: list[~discord_http.object.Snowflake | int] | None = <MISSING>, exempt_channels: list[~discord_http.object.Snowflake | int] | None = <MISSING>, reason: str | None = None) AutoModRule[source]

Create an automod rule

Parameters:
  • name (str) – Name of the automod

  • event_type (AutoModRuleEventType | int) – What type of event

  • keyword_filter (list[str] | None) – Keywords to filter

  • regex_patterns (list[str] | None) – Keywords in regex pattern to filter

  • presets (list[AutoModRulePresetType] | None) – Automod presets to include

  • allow_list (list[str] | None) – List of keywords that are allowed

  • mention_total_limit (int | None) – How many unique mentions allowed before trigger

  • mention_raid_protection_enabled (bool) – If this should apply for raids

  • alert_channel (Snowflake | int | None) – Where the action should be logged

  • timeout_seconds (int | None) – How many seconds the user in question should be timed out

  • message (str | None) – What message the user gets when action is taken

  • enabled (bool) – If the automod should be enabled or not

  • exempt_roles (list[Snowflake | int] | None) – Which roles are allowed to bypass

  • exempt_channels (list[Snowflake | int] | None) – Which channels are allowed to bypass

  • reason (str | None) – Reason for editing the automod

Returns:

The automod that was just edited

Return type:

AutoModRule

async fetch() AutoModRule[source]

AutoModRule: Fetches more information about the automod rule

property guild: Guild | PartialGuild | None

The guild object this event is in

Type:

PartialGuild