AuditLogEntry

Represents an entry of an audit log.

Attributes

changes : None | dict<str, AuditLogChange>

The changes of the entry.

details : None | dict<str, object>

Additional information for the specific action types.

guild_id : int

The source guild's identifier.

id : int

The unique identifier number of the entry.

reason : None, str

The reason provided with the logged action.

target_id : int

The entry's target's identifier.

If no target is provided, this value defaults to 0.

The logged event's type.

user_id : int

The user's identifier who triggered the event.

_parent_reference : None, WeakReferer to AuditLog

Reference to the audit log entry keys' parent.

Properties

created_at

When the entity was created.

Returns

created_at : datetime

guild

Returns the audit log's guild.

Returns

guild : None, Guild

parent

Returns the entry's parent audit log.

Returns

parent : None, AuditLog

target

Tries to resolve the target entity of the audit log entry.

If the entity is not cached, returns None.

Returns

target : None, Guild, Channel, ClientUserBase, Role, Webhook,

user

Returns the user who triggered the event's creation.

Returns

user : None, ClientUserBase

Returns ˙None if not an user triggered it.

Methods

__new__(...)

Creates a new audit log entry with the given fields.

ParameterTypeOptionalKeyword onlyDescription
changes

None | iterable<AuditLogChange>

The changes of the entry.

details

None | dict<str, object>

Additional information for the specific action types.

entry_type

AuditLogEntryType, int

The logged event's type.

guild_id

int, None, Guild

The source guild's identifier.

reason

None, str

The reason provided with the logged action.

target_id

int

The entry's target's identifier.

user_id

int, None, ClientUserBase

The user's identifier who triggered the event.

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

copy()

Copies the audit log entry.

Returns

new : instance<type<self>>

copy_with(...)

Copies the audit log entry with the given fields.

ParameterTypeOptionalKeyword onlyDescription
changes

None | iterable<AuditLogChange>

The changes of the entry.

details

None | dict<str, object>

Additional information for the specific action types.

entry_type

AuditLogEntryType, int

The logged event's type.

guild_id

int, None, Guild

The source guild's identifier.

reason

None, str

The reason provided with the logged action.

target_id

int

The entry's target's identifier.

user_id

int, None, ClientUserBase

The user's identifier who triggered the event.

Returns

new : instance<type<self>>

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

from_data(data, ...)

Creates an audit log entry, from entry data sent inside of an AuditLog 's data and from the audit itself.

ParameterTypeOptionalDefaultDescription
data

dict of (str, object) items

Data received from Discord.

parent

None, AuditLog

None

The parent of the entry that contains the respective guild, the included users, webhooks and the integrations, etc... to work with.

Returns

self : instance<cls>

Returns None if Discord is derping like hell.

get_change(attribute_name)

Gets the audit log entry's change for the given attribute_name.

ParameterTypeDescription
attribute_name

str

The change by its attribute name to get.

Returns

change : None, AuditLogChange

get_detail(name)

Gets the audit log entry's detail for the given name.

ParameterTypeDescription
name

str

The detail's name.

Returns

change : None, object

iter_changes()

Iterates over the changes of the audit log entry.

This method is an iterable generator.

Yields

change : AuditLogChange

iter_details()

Iterates over the details of the audit log entry.

This method is an iterable generator.

Yields

detail : (str, object)

precreate(entry_id, ...)

Creates a new audit log entry with the given fields.

ParameterTypeOptionalKeyword onlyDescription
entry_id

int

The entry's unique identifier.

changes

None | iterable<AuditLogChange>

The changes of the entry.

details

None | dict<str, object>

Additional information for the specific action types.

parent

None | AuditLog

The parent audit log for the entry.

**keyword_parameters

Keyword Parameters

Additional keyword parameters.

entry_type

AuditLogEntryType, int

The logged event's type.

guild

int, None, Guild

Alternative for guild_id.

guild_id

int, None, Guild

The source guild's identifier.

reason

None, str

The reason provided with the logged action.

target_id

int

The entry's target's identifier.

user

int, None, ClientUserBase

Alternative for user_id.

user_id

int, None, ClientUserBase

The user's identifier who triggered the event.

Returns

self : instance<cls>

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

to_data(...)

Serialises the audit log entry.

ParameterTypeOptionalKeyword onlyDescription
defaults

bool

Whether fields with their default values should be included as well.

Returns

data : dict<str, object>

_is_equal_same_type(other)

Returns whether the two audit log entries are equal.

ParameterTypeDescription
other

instance<type<self>>

The other instance. Must be the same type as self.

Returns

is_equal : bool

__eq__()

Returns whether the two audit log entries are equal.

__ge__()

Whether this entity's id is greater or equal than the other's.

__getattr__()

Drops a rich attribute error.

__gt__()

Whether this entity's id is greater than the other's.

__hash__()

Returns the audit log entry's hash value.

__le__()

Whether this entity's id is less or equal than the other's.

__lt__()

Whether this entity's id is less than the other's.

__ne__()

Returns whether the two audit log entries are not equal.

__repr__()

Returns the representation of the audit log entry.