Skip to content

Latest commit

 

History

History
528 lines (289 loc) · 13.7 KB

audit_logs.rst

File metadata and controls

528 lines (289 loc) · 13.7 KB

discord

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.

AuditLogEntry

AuditLogEntry

AuditLogChanges

An audit log change set.

before

The old value. The attribute has the type of AuditLogDiff.

Depending on the AuditLogActionCategory retrieved by ~AuditLogEntry.category, the data retrieved by this attribute differs:

Category

Description

~AuditLogActionCategory.create All attributes are set to None.
~AuditLogActionCategory.delete All attributes are set the value before deletion.
~AuditLogActionCategory.update All attributes are set the value before updating.
None No attributes are set.

after

The new value. The attribute has the type of AuditLogDiff.

Depending on the AuditLogActionCategory retrieved by ~AuditLogEntry.category, the data retrieved by this attribute differs:

Category

Description

~AuditLogActionCategory.create All attributes are set to the created value
~AuditLogActionCategory.delete All attributes are set to None
~AuditLogActionCategory.update All attributes are set the value after updating.
None No attributes are set.

AuditLogDiff

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.

name

A name of something.

type

str

icon

A guild's icon. See also Guild.icon.

type

Asset

splash

The guild's invite splash. See also Guild.splash.

type

Asset

discovery_splash

The guild's discovery splash. See also Guild.discovery_splash.

type

Asset

banner

The guild's banner. See also Guild.banner.

type

Asset

owner

The guild's owner. See also Guild.owner

type

Union[Member, User]

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

int

mfa_level

The guild's MFA level. See Guild.mfa_level.

type

int

widget_enabled

The guild's widget has been enabled or disabled.

type

bool

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

VerificationLevel

default_notifications

The guild's default notification level.

See also Guild.default_notifications.

type

NotificationLevel

explicit_content_filter

The guild's content filter.

See also Guild.explicit_content_filter.

type

ContentFilter

default_message_notifications

The guild's default message notification setting.

type

int

vanity_url_code

The guild's vanity URL.

See also Guild.vanity_invite and Guild.edit.

type

str

position

The position of a Role or abc.GuildChannel.

type

int

type

The type of channel or sticker.

type

Union[ChannelType, StickerType]

topic

The topic of a TextChannel or StageChannel.

See also TextChannel.topic or StageChannel.topic.

type

str

bitrate

The bitrate of a VoiceChannel.

See also VoiceChannel.bitrate.

type

int

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 or User or Role. If this object is not found then it is a Object with an ID being filled and a type 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

Union[StagePrivacyLevel, ScheduledEventPrivacyLevel]

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.

type

List[Union[Role, Object]]

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

bool

mute

Whether the member is being server muted.

See also VoiceState.mute.

type

bool

permissions

The permissions of a role.

See also Role.permissions.

type

Permissions

colour color

The colour of a role.

See also Role.colour

type

Colour

hoist

Whether the role is being hoisted or not.

See also Role.hoist

type

bool

mentionable

Whether the role is mentionable or not.

See also Role.mentionable

type

bool

code

The invite's code.

See also Invite.code

type

str

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

int

uses

The invite's current uses.

See also Invite.uses.

type

int

max_age

The invite's max age in seconds.

See also Invite.max_age.

type

int

temporary

If the invite is a temporary invite.

See also Invite.temporary.

type

bool

allow deny

The permissions being allowed or denied.

type

Permissions

id

The ID of the object being changed.

type

int

avatar

The avatar of a member.

See also User.avatar.

type

Asset

slowmode_delay

The number of seconds members have to wait before sending another message in the channel.

See also TextChannel.slowmode_delay.

type

int

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

VoiceRegion

video_quality_mode

The camera video quality for the voice channel's participants.

See also VoiceChannel.video_quality_mode.

type

VideoQualityMode

format_type

The format type of a sticker being changed.

See also GuildSticker.format

type

StickerFormatType

emoji

The name of the emoji that represents a sticker being changed.

See also GuildSticker.emoji

type

str

description

The description of a sticker being changed.

See also GuildSticker.description

type

str

available

The availability of a sticker being changed.

See also GuildSticker.available

type

bool

archived

The thread is now archived.

type

bool

locked

The thread is being locked or unlocked.

type

bool

auto_archive_duration

The thread's auto archive duration being changed.

See also Thread.auto_archive_duration

type

int

default_auto_archive_duration

The default auto archive duration for newly created threads being changed.

type

int

invitable

Non-moderators can now add other non-moderators to this thread.

type

bool

command_id

This command's permissions were updated.

type

int

status

The voice channel status of a VoiceChannel.

See also VoiceChannel.status.

type

str