AutoModRule

discord_http.automod module

class discord_http.automod.AutoModRule(*, state, data)

Bases: PartialAutoModRule

Parameters:
property creator: PartialUser

The user that created the automod rule in User object form.

class discord_http.automod.AutoModRuleAction(*, type, channel_id=None, duration_seconds=None, custom_message=None)

Bases: object

Parameters:
classmethod create_alert_location(channel) Self

Create an auto moderation rule action to send an alert message.

Parameters:

channel (Snowflake | int) – The channel to send the alert message to

Return type:

Self

Returns:

The auto moderation rule action

classmethod create_message(message) Self

Create an auto moderation rule action to block a message.

Parameters:

message (str) – The message to block

Return type:

Self

Returns:

The auto moderation rule action

classmethod create_timeout(seconds) Self

Create an auto moderation rule action to timeout a user.

Parameters:

seconds (int) – The number of seconds to timeout the user for

Return type:

Self

Returns:

The auto moderation rule action

classmethod from_dict(data) Self

Create an auto moderation rule action from a dictionary.

Parameters:

data (dict) – The dictionary to create the auto moderation rule action from

Return type:

Self

Returns:

The auto moderation rule action

to_dict() dict

The auto moderation rule action as a dictionary.

Return type:

dict

class discord_http.automod.AutoModRuleTriggers(*, keyword_filter=None, regex_patterns=None, presets=None, allow_list=None, mention_total_limit=None, mention_raid_protection_enabled=False)

Bases: object

Parameters:
classmethod from_dict(data) Self

Create an auto moderation rule from a dictionary.

Parameters:

data (dict) – The dictionary to create the auto moderation rule from

Return type:

Self

Returns:

The auto moderation rule

to_dict() dict

The auto moderation rule as a dictionary.

Return type:

dict

class discord_http.automod.PartialAutoModRule(*, state, id, guild_id)

Bases: PartialBase

Parameters:
async delete(*, reason=None) None

Delete the automod rule.

Parameters:

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

Return type:

None

async edit(*, name=<MISSING>, event_type=<MISSING>, keyword_filter=<MISSING>, regex_patterns=<MISSING>, presets=<MISSING>, allow_list=<MISSING>, mention_total_limit=<MISSING>, mention_raid_protection_enabled=<MISSING>, alert_channel=<MISSING>, timeout_seconds=<MISSING>, message=<MISSING>, enabled=<MISSING>, exempt_roles=<MISSING>, exempt_channels=<MISSING>, reason=None) AutoModRule

Create an automod rule.

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

  • event_type (AutoModRuleEventType | int | None) – 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

Return type:

AutoModRule

Returns:

The automod that was just edited

async fetch() AutoModRule

Fetches more information about the automod rule.

Return type:

AutoModRule

property guild: Guild | PartialGuild | None

The guild object this event is in.