Skip to content

hikari.auto_mod#

Entities that are used to describe auto-moderation on Discord.

AutoModActionType #

Bases: int, Enum

The type of an auto-moderation rule action.

BLOCK_MEMBER_INTERACTION class-attribute instance-attribute #

BLOCK_MEMBER_INTERACTION = 4

Prevents a member from using text, voice, or other interactions.

BLOCK_MESSAGE class-attribute instance-attribute #

BLOCK_MESSAGE = 1

Block the content of the triggering message.

SEND_ALERT_MESSAGE class-attribute instance-attribute #

SEND_ALERT_MESSAGE = 2

Log the triggering user content to a specified channel.

TIMEOUT class-attribute instance-attribute #

TIMEOUT = 3

Timeout the triggering message's author for a specified duration.

This type can only be set for KEYWORD and MENTION_SPAM rules.

Requires the MODERATE_MEMBERS permission to use.

AutoModBlockMemberAction #

Bases: PartialAutoModAction

Prevents a member from using text, voice, or other interactions.

AutoModBlockMessage #

Bases: PartialAutoModAction

Block the content of the triggering message.

AutoModEventType #

Bases: int, Enum

Type of event to check for an auto-moderation rule.

MEMBER_UPDATE class-attribute instance-attribute #

MEMBER_UPDATE = 2

When a member updates their guild or user profile.

MESSAGE_SEND class-attribute instance-attribute #

MESSAGE_SEND = 1

When a member sends or edits a message in the guild.

AutoModKeywordPresetType #

Bases: int, Enum

Discord's KEYWORD_PRESET type.

PROFANITY class-attribute instance-attribute #

PROFANITY = 1

Trigger on words which may be considered forms of swearing or cursing.

SEXUAL_CONTENT class-attribute instance-attribute #

SEXUAL_CONTENT = 2

Trigger on words that refer to explicit behaviour or activity.

SLURS class-attribute instance-attribute #

SLURS = 3

Trigger on personal insults and words which "may be considered hate speech".

AutoModRule #

Bases: Unique

Auto moderation rule which defines how user content is filtered.

actions class-attribute instance-attribute #

actions: Sequence[PartialAutoModAction] = field(
    eq=False, hash=False, repr=False
)

Sequence of the actions which will execute when this rule is triggered.

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False,
    eq=False,
    hash=False,
    metadata={SKIP_DEEP_COPY: True},
)

The client application that models may use for procedures.

creator_id class-attribute instance-attribute #

creator_id: Snowflake = field(
    eq=False, hash=False, repr=True
)

ID of the user who originally created this rule.

event_type class-attribute instance-attribute #

event_type: AutoModEventType = field(
    eq=False, hash=False, repr=True
)

The type of event this rule triggers on.

exempt_channel_ids class-attribute instance-attribute #

exempt_channel_ids: Sequence[Snowflake] = field(
    eq=False, hash=False, repr=False
)

A sequence of IDs of (up to 20) channels which aren't effected by this rule.

exempt_role_ids class-attribute instance-attribute #

exempt_role_ids: Sequence[Snowflake] = field(
    eq=False, hash=False, repr=False
)

A sequence of IDs of (up to 50) roles which aren't effected by this rule.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field(eq=False, hash=False, repr=True)

ID of the guild this rule belongs to.

id class-attribute instance-attribute #

id: Snowflake = field(eq=True, hash=True, repr=True)

The ID of this entity.

is_enabled class-attribute instance-attribute #

is_enabled: bool = field(eq=False, hash=False, repr=False)

Whether this rule is enabled.

name class-attribute instance-attribute #

name: str = field(eq=False, hash=False, repr=True)

The rule's name.

trigger class-attribute instance-attribute #

trigger: PartialAutoModTrigger = field(
    eq=False, hash=False, repr=False
)

The content this rule triggers on.

AutoModSendAlertMessage #

Bases: PartialAutoModAction

Log the triggering content to a specific channel.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel to log trigger events to.

AutoModTimeout #

Bases: PartialAutoModAction

Timeout the triggering message's author for a specified duration.

This type can only be set for KEYWORD and MENTION_SPAM rules.

duration class-attribute instance-attribute #

duration: timedelta = field()

The total seconds to timeout the user for (max 2419200 seconds/4 weeks).

AutoModTriggerType #

Bases: int, Enum

Type of trigger for an auto-moderation rule.

KEYWORD class-attribute instance-attribute #

KEYWORD = 1

Match message content against a list of keywords and regexes.

KEYWORD_PRESET class-attribute instance-attribute #

KEYWORD_PRESET = 4

Discord's preset keyword triggers.

MEMBER_PROFILE class-attribute instance-attribute #

MEMBER_PROFILE = 6

Match user profiles against a list of keywords and regexes.

MENTION_SPAM class-attribute instance-attribute #

MENTION_SPAM = 5

Match messages that exceed the allowed limit of role or user mentions.

SPAM class-attribute instance-attribute #

SPAM = 3

Discord's guild anti-spam system.

KeywordPresetTrigger #

Bases: PartialAutoModTrigger

A trigger based on a predefined set of presets provided by Discord.

allow_list class-attribute instance-attribute #

allow_list: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

A sequence of filters which will be exempt from triggering the preset trigger.

presets class-attribute instance-attribute #

presets: Sequence[AutoModKeywordPresetType | int] = field(
    eq=False, hash=False, repr=False
)

The predefined presets provided by Discord to match against.

KeywordTrigger #

Bases: PartialAutoModTrigger

A trigger based on matching message content against a list of keywords.

allow_list class-attribute instance-attribute #

allow_list: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

A sequence of filters which will be exempt from triggering the preset trigger.

keyword_filter class-attribute instance-attribute #

keyword_filter: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

The filter strings this trigger checks for.

regex_patterns class-attribute instance-attribute #

regex_patterns: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

The filter regexes this trigger checks for.

MemberProfileTrigger #

Bases: PartialAutoModTrigger

A trigger based on matching user profile content against a list of keywords.

allow_list class-attribute instance-attribute #

allow_list: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

A sequence of filters which will be exempt from triggering the preset trigger.

keyword_filter class-attribute instance-attribute #

keyword_filter: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

The filter strings this trigger checks for.

This supports a wildcard matching strategy which is documented at https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies.

regex_patterns class-attribute instance-attribute #

regex_patterns: Sequence[str] = field(
    eq=False, hash=False, repr=False
)

The filter regexes this trigger checks for.

MentionSpamTrigger #

Bases: PartialAutoModTrigger

A trigger based on matching mention spams in message content.

mention_raid_protection_enabled class-attribute instance-attribute #

mention_raid_protection_enabled: bool = field(
    eq=False, hash=False, repr=False
)

Whether to automatically detect mention raids.

mention_total_limit class-attribute instance-attribute #

mention_total_limit: int = field(
    eq=False, hash=False, repr=False
)

Total number of unique role and user mentions allowed per message.

PartialAutoModAction #

Base class for an action which is executed when a rule is triggered.

type class-attribute instance-attribute #

The type of auto-moderation action.

PartialAutoModTrigger #

Base class representing the content a rule triggers on.

type class-attribute instance-attribute #

type: AutoModTriggerType = field(
    eq=False, hash=False, repr=False
)

The type action this triggers.

SpamTrigger #

Bases: PartialAutoModTrigger

A trigger based on Discord's spam detection.