AutoModRule¶
discord_http.automod module¶
- class discord_http.automod.AutoModRule(*, state, data)¶
Bases:
PartialAutoModRuleRepresents an auto moderation rule in a guild.
- Parameters:
state (DiscordAPI)
data (dict)
- 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.
- event_type: AutoModRuleEventType¶
The type of event that triggers the automod rule.
- trigger_type: AutoModRuleTriggerType¶
The type of trigger for the automod rule.
- actions: list[AutoModRuleAction]¶
The actions that the automod rule takes when triggered.
- trigger_metadata: AutoModRuleTriggers | None¶
The metadata for the trigger of the automod rule.
- exempt_roles: list[PartialRole]¶
The roles that are exempt from the automod rule.
- exempt_channels: list[PartialChannel]¶
The channels that are exempt from the automod rule.
- 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:
objectRepresents an action for an auto moderation rule.
- Parameters:
type (AutoModRuleActionType)
duration_seconds (int | None)
custom_message (str | None)
- type: AutoModRuleActionType¶
The type of action to take when the auto moderation rule is triggered.
- channel_id¶
The channel to send the alert message to if action type is send_alert_message.
- 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
- 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
- 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:
objectRepresents the triggers for an auto moderation rule.
- Parameters:
- presets: list[AutoModRulePresetType] | None¶
List of auto moderation presets to filter.
- class discord_http.automod.PartialAutoModRule(*, state, id, guild_id)¶
Bases:
PartialBaseRepresents a partial auto moderation rule, usually from an event.
- Parameters:
state (DiscordAPI)
id (int)
guild_id (int)
- property guild: Guild | PartialGuild | None¶
The guild object this event is in.
- async fetch() AutoModRule¶
Fetches more information about the automod rule.
- Return type:
- 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