Audit Log Data¶
Working with Guild.audit_logs()
is a complicated process with a lot of machinery
involved. The library attempts to make it easy to use and friendly. In order to accomplish
this goal, it must make use of a couple of data classes that aid in this goal.
- class discord.AuditLogEntry(*, users, data, guild)[source]¶
Represents an Audit Log entry.
You retrieve these via
Guild.audit_logs()
.- x == y
Checks if two entries are equal.
- x != y
Checks if two entries are not equal.
- hash(x)
Returns the entry’s hash.
Changed in version 1.7: Audit log entries are now comparable and hashable.
- action¶
The action that was done.
- Type:
- user¶
The user who initiated this action. Usually a
Member
, unless gone then it’s aUser
.- Type:
Optional[
abc.User
]
- target¶
The target that got changed. The exact type of this depends on the action being done.
- Type:
Any
- extra¶
Extra information that this entry has that might be useful. For most actions, this is
None
. However, in some cases it contains extra information. SeeAuditLogAction
for which actions have this field filled out.- Type:
Any
- created_at¶
Returns the entry’s creation time in UTC.
- category¶
The category of the action, if applicable.
- changes¶
The list of changes this entry has.
- before¶
The target’s prior state.
- after¶
The target’s subsequent state.
- class discord.AuditLogChanges[source]¶
An audit log change set.
- before¶
The old value. The attribute has the type of
AuditLogDiff
.Depending on the
AuditLogActionCategory
retrieved bycategory
, the data retrieved by this attribute differs:
- after¶
The new value. The attribute has the type of
AuditLogDiff
.Depending on the
AuditLogActionCategory
retrieved bycategory
, the data retrieved by this attribute differs:
- afk_channel
- afk_timeout
- allow
- archived
- auto_archive_duration
- available
- avatar
- banner
- bitrate
- channel
- code
- color
- colour
- command_id
- deaf
- default_auto_archive_duration
- default_message_notifications
- default_notifications
- deny
- description
- discovery_splash
- emoji
- explicit_content_filter
- format_type
- hoist
- icon
- id
- image
- invitable
- inviter
- locked
- max_age
- max_uses
- mentionable
- mfa_level
- mute
- name
- nick
- overwrites
- owner
- permissions
- position
- privacy_level
- public_updates_channel
- roles
- rtc_region
- rules_channel
- slowmode_delay
- splash
- status
- system_channel
- temporary
- topic
- type
- uses
- vanity_url_code
- verification_level
- video_quality_mode
- widget_channel
- widget_enabled
- class discord.AuditLogDiff[source]¶
Represents an audit log “change” object. A change object has dynamic attributes that depend on the type of action being done. Certain actions map to certain attributes being set.
Note that accessing an attribute that does not match the specified action will lead to an attribute error.
To get a list of attributes that have been set, you can iterate over them. To see a list of all possible attributes that could be set based on the action being done, check the documentation for
AuditLogAction
, otherwise check the documentation below for all attributes that are possible.- iter(diff)
Returns an iterator over (attribute, value) tuple of this diff.
- icon¶
A guild’s icon. See also
Guild.icon
.- Type:
- splash¶
The guild’s invite splash. See also
Guild.splash
.- Type:
- discovery_splash¶
The guild’s discovery splash. See also
Guild.discovery_splash
.- Type:
- banner¶
The guild’s banner. See also
Guild.banner
.- Type:
- owner¶
The guild’s owner. See also
Guild.owner
- afk_channel¶
The guild’s AFK channel.
If this could not be found, then it falls back to a
Object
with the ID being set.See
Guild.afk_channel
.- Type:
Union[
VoiceChannel
,Object
]
- system_channel¶
The guild’s system channel.
If this could not be found, then it falls back to a
Object
with the ID being set.See
Guild.system_channel
.- Type:
Union[
TextChannel
,Object
]
- rules_channel¶
The guild’s rules channel.
If this could not be found then it falls back to a
Object
with the ID being set.See
Guild.rules_channel
.- Type:
Union[
TextChannel
,Object
]
- public_updates_channel¶
The guild’s public updates channel.
If this could not be found then it falls back to a
Object
with the ID being set.See
Guild.public_updates_channel
.- Type:
Union[
TextChannel
,Object
]
- afk_timeout¶
The guild’s AFK timeout. See
Guild.afk_timeout
.- Type:
- mfa_level¶
The guild’s MFA level. See
Guild.mfa_level
.- Type:
- widget_channel¶
The widget’s channel.
If this could not be found then it falls back to a
Object
with the ID being set.- Type:
Union[
TextChannel
,Object
]
- verification_level¶
The guild’s verification level.
See also
Guild.verification_level
.- Type:
- default_notifications¶
The guild’s default notification level.
See also
Guild.default_notifications
.- Type:
- explicit_content_filter¶
The guild’s content filter.
See also
Guild.explicit_content_filter
.- Type:
- vanity_url_code¶
The guild’s vanity URL.
See also
Guild.vanity_invite()
andGuild.edit()
.- Type:
- position¶
The position of a
Role
orabc.GuildChannel
.- Type:
- type¶
The type of channel or sticker.
- Type:
Union[
ChannelType
,StickerType
]
- topic¶
The topic of a
TextChannel
orStageChannel
.See also
TextChannel.topic
orStageChannel.topic
.- Type:
- bitrate¶
The bitrate of a
VoiceChannel
.See also
VoiceChannel.bitrate
.- Type:
- overwrites¶
A list of permission overwrite tuples that represents a target and a
PermissionOverwrite
for said target.The first element is the object being targeted, which can either be a
Member
orUser
orRole
. If this object is not found then it is aObject
with an ID being filled and atype
attribute set to either'role'
or'member'
to help decide what type of ID it is.- Type:
List[Tuple[target,
PermissionOverwrite
]]
- privacy_level¶
The privacy level of the stage instance or scheduled event.
- Type:
- roles¶
A list of roles being added or removed from a member.
If a role is not found then it is a
Object
with the ID and name being filled in.
- nick¶
The nickname of a member.
See also
Member.nick
- Type:
Optional[
str
]
- deaf¶
Whether the member is being server deafened.
See also
VoiceState.deaf
.- Type:
- mute¶
Whether the member is being server muted.
See also
VoiceState.mute
.- Type:
- permissions¶
The permissions of a role.
See also
Role.permissions
.- Type:
- colour¶
- color¶
The colour of a role.
See also
Role.colour
- Type:
- hoist¶
Whether the role is being hoisted or not.
See also
Role.hoist
- Type:
- mentionable¶
Whether the role is mentionable or not.
See also
Role.mentionable
- Type:
- code¶
The invite’s code.
See also
Invite.code
- Type:
- channel¶
A guild channel.
If the channel is not found then it is a
Object
with the ID being set. In some cases the channel name is also set.- Type:
Union[
abc.GuildChannel
,Object
]
- inviter¶
The user who created the invite.
See also
Invite.inviter
.- Type:
Optional[
User
]
- max_uses¶
The invite’s max uses.
See also
Invite.max_uses
.- Type:
- uses¶
The invite’s current uses.
See also
Invite.uses
.- Type:
- max_age¶
The invite’s max age in seconds.
See also
Invite.max_age
.- Type:
- temporary¶
If the invite is a temporary invite.
See also
Invite.temporary
.- Type:
- avatar¶
The avatar of a member.
See also
User.avatar
.- Type:
- slowmode_delay¶
The number of seconds members have to wait before sending another message in the channel.
See also
TextChannel.slowmode_delay
.- Type:
- rtc_region¶
The region for the voice channel’s voice communication. A value of
None
indicates automatic voice region detection.See also
VoiceChannel.rtc_region
.- Type:
- video_quality_mode¶
The camera video quality for the voice channel’s participants.
See also
VoiceChannel.video_quality_mode
.- Type:
- format_type¶
The format type of a sticker being changed.
See also
GuildSticker.format
- Type:
- emoji¶
The name of the emoji that represents a sticker being changed.
See also
GuildSticker.emoji
- Type:
- description¶
The description of a sticker being changed.
See also
GuildSticker.description
- Type:
- available¶
The availability of a sticker being changed.
See also
GuildSticker.available
- Type:
- auto_archive_duration¶
The thread’s auto archive duration being changed.
See also
Thread.auto_archive_duration
- Type:
- default_auto_archive_duration¶
The default auto archive duration for newly created threads being changed.
- Type:
- status¶
The voice channel status of a
VoiceChannel
.See also
VoiceChannel.status
.- Type:
- image¶
The cover image of a
ScheduledEvent
.- Type: