Audit¶
discord_http.audit module¶
- class discord_http.audit.AuditChange[_AuditChangeT](*, entry, data)¶
Bases:
Generic[_AuditChangeT]Represents a change in an audit log entry.
- Parameters:
entry (AuditLogEntry)
data (dict)
- entry: AuditLogEntry¶
The audit log entry this change belongs to.
- class discord_http.audit.AuditLogEntry(*, state, data, guild=None, users=None)¶
Bases:
SnowflakeRepresents an entry in an audit log.
- Parameters:
state (DiscordAPI)
data (dict)
guild (PartialGuild | None)
- guild: PartialGuild¶
The guild this audit log entry belongs to.
- action_type: AuditLogType¶
The type of action that was performed.
- changes: list[AuditChange]¶
A list of changes made in this audit log entry.
- property user: User | PartialUser | None¶
The user object of the audit log if available.
- property target: Snowflake | None¶
The target object of the audit log.
The Snowflake can be a PartialChannel, User, PartialRole, etc
- get_change(key) Optional[AuditChange[Any]]¶
Returns the change with the given key, if it exists.
- Overloads:
key (
Literal['verification_level']) →Optional[AuditChange[VerificationLevel]]key (
Literal['explicit_content_filter']) →Optional[AuditChange[ContentFilterLevel]]key (
Literal['allow','deny','permissions']) →Optional[AuditChange[Permissions]]key (
Literal['id']) →Optional[AuditChange[Snowflake]]key (
Literal['color']) →Optional[AuditChange[Colour]]key (
Literal['owner_id','inviter_id']) →Optional[AuditChange[User|PartialUser]]key (
Literal['channel_id','afk_channel_id','system_channel_id','widget_channel_id','rules_channel_id','public_updates_channel_id']) →Optional[AuditChange[PartialChannel]]key (
Literal['system_channel_flags']) →Optional[AuditChange[SystemChannelFlags]]key (
Literal['permission_overwrites']) →Optional[AuditChange[list[tuple[PartialUser|PartialRole,PermissionOverwrite]]]]key (
Literal['splash_hash','banner_hash','discovery_splash_hash','icon_hash','avatar_hash','image_hash']) →Optional[AuditChange[Asset|None]]key (
Literal['rate_limit_per_user','default_thread_rate_limit_per_user']) →Optional[AuditChange[int]]key (
Literal['guild_id']) →Optional[AuditChange[PartialGuild|None]]key (
Literal['default_message_notifications']) →Optional[AuditChange[DefaultNotificationLevel]]key (
Literal['video_quality_mode']) →Optional[AuditChange[VideoQualityType]]key (
Literal['privacy_level']) →Optional[AuditChange[PrivacyLevelType]]key (
Literal['format_type']) →Optional[AuditChange[StickerFormatType]]key (
Literal['type']) →Optional[AuditChange[ChannelType|StickerType|WebhookType|PermissionType|str]]key (
Literal['communication_disabled_until']) →Optional[AuditChange[datetime|None]]key (
Literal['expire_behavior']) →Optional[AuditChange[ExpireBehaviour]]key (
Literal['mfa_level']) →Optional[AuditChange[MFALevel]]key (
Literal['status']) →Optional[AuditChange[ScheduledEventStatusType]]key (
Literal['entity_type']) →Optional[AuditChange[ScheduledEventEntityType]]key (
Literal['preferred_locale']) →Optional[AuditChange[Locale]]key (
Literal['trigger_type']) →Optional[AuditChange[AutoModRuleTriggerType]]key (
Literal['trigger_metadata']) →Optional[AuditChange[AutoModRuleTriggers]]key (
Literal['event_type']) →Optional[AuditChange[AutoModRuleEventType]]key (
Literal['actions']) →Optional[AuditChange[list[AutoModRuleAction]]]key (
Literal['exempt_channels']) →Optional[AuditChange[list[PartialChannel]]]key (
Literal['exempt_roles']) →Optional[AuditChange[list[PartialRole]]]key (
Literal['applied_tags']) →Optional[AuditChange[list[Snowflake]]]key (
Literal['available_tags']) →Optional[AuditChange[list[ForumTag]]]key (
Literal['flags']) →Optional[AuditChange[BaseFlag|int]]key (
Literal['default_reaction_emoji']) →Optional[AuditChange[EmojiParser|None]]key (
Literal['$add','$remove']) →Optional[AuditChange[list[PartialRole]]]key (
str) →Optional[AuditChange[Any]]
- Parameters:
key (str)
- Return type:
AuditChange[Any] | None
When called with a known string literal (e.g. color), the return type is narrowed via overloads so that old_value and new_value carry the correct type (e.g. AuditChange[Colour]). Unknown keys fall back to AuditChange[Any].
- Parameters:
key (
str) – The key of the change to retrieve.- Returns:
The change with the given key, or None if no such change exists.
- Return type:
AuditChange[Any] | None