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 #
AutoModBlockMessage #
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
#
The client application that models may use for procedures.
creator_id class-attribute
instance-attribute
#
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
#
A sequence of IDs of (up to 20) channels which aren't effected by this rule.
exempt_role_ids class-attribute
instance-attribute
#
A sequence of IDs of (up to 50) roles which aren't effected by this rule.
guild_id class-attribute
instance-attribute
#
ID of the guild this rule belongs to.
id class-attribute
instance-attribute
#
The ID of this entity.
is_enabled class-attribute
instance-attribute
#
Whether this rule is enabled.
name class-attribute
instance-attribute
#
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.
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.
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.
KeywordPresetTrigger #
Bases: PartialAutoModTrigger
A trigger based on a predefined set of presets provided by Discord.
allow_list class-attribute
instance-attribute
#
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.
MemberProfileTrigger #
Bases: PartialAutoModTrigger
A trigger based on matching user profile content against a list of keywords.
allow_list class-attribute
instance-attribute
#
A sequence of filters which will be exempt from triggering the preset trigger.
keyword_filter class-attribute
instance-attribute
#
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.
MentionSpamTrigger #
Bases: PartialAutoModTrigger
A trigger based on matching mention spams in message content.
mention_raid_protection_enabled class-attribute
instance-attribute
#
Whether to automatically detect mention raids.
PartialAutoModAction #
Base class for an action which is executed when a rule is triggered.
type class-attribute
instance-attribute
#
type: AutoModActionType = field()
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.