AutoModRule¶
discord_http.automod module¶
- class discord_http.automod.AutoModRule(*, state, data)¶
Bases:
PartialAutoModRule
- Parameters:
state (DiscordAPI)
data (dict)
- 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:
type (AutoModRuleActionType)
duration_seconds (int | None)
custom_message (str | None)
- classmethod create_alert_location(channel) Self ¶
Create an auto moderation rule action to send an alert message.
- 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
- 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:
- class discord_http.automod.PartialAutoModRule(*, state, id, guild_id)¶
Bases:
PartialBase
- Parameters:
state (DiscordAPI)
id (int)
guild_id (int)
- 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:
event_type (
AutoModRuleEventType
|int
|None
) – What type of eventregex_patterns (
list
[str
] |None
) – Keywords in regex pattern to filterpresets (
list
[AutoModRulePresetType
] |None
) – Automod presets to includeallow_list (
list
[str
] |None
) – List of keywords that are allowedmention_total_limit (
int
|None
) – How many unique mentions allowed before triggermention_raid_protection_enabled (
bool
) – If this should apply for raidsalert_channel (
Snowflake
|int
|None
) – Where the action should be loggedtimeout_seconds (
int
|None
) – How many seconds the user in question should be timed outmessage (
str
|None
) – What message the user gets when action is takenenabled (
bool
) – If the automod should be enabled or notexempt_roles (
list
[Snowflake
|int
] |None
) – Which roles are allowed to bypassexempt_channels (
list
[Snowflake
|int
] |None
) – Which channels are allowed to bypass
- Return type:
- Returns:
The automod that was just edited
- async fetch() AutoModRule ¶
Fetches more information about the automod rule.
- Return type:
- property guild: Guild | PartialGuild | None¶
The guild object this event is in.