AuditLogIterator

An async iterator over a guild's audit logs.

Attributes

application_commands : dict of (int, ApplicationCommand) items

A dictionary that contains the mentioned application commands by the audi log entries. The keys are the id-s of the application commands, meanwhile the values are the application commands themselves.

auto_moderation_rules : dict of (int, ApplicationCommand) items

A dictionary that contains the auto moderation rules mentioned inside of the audit log entries. The keys are the id-s of the rules and the values are the rules themselves.

client : Client

The client, who will execute the api requests.

entries : list of AuditLogEntry

A list of audit log entries that the audit log contains.

guild_id : int

The audit logs' respective guild's identifier.

integrations : dict of (int, Integration) items

A dictionary that contains the mentioned integrations by the audit log's entries. The keys are the id-s of the integrations, meanwhile the values are the integrations themselves.

scheduled_events : dict of (int, ScheduledEvent) items

A dictionary containing the scheduled events mentioned inside of the audit logs.

threads : dict of (int, Channel) items

A dictionary containing the mentioned threads inside of the audit logs.

users : dict of (int, ClientUserBase) items

A dictionary that contains the mentioned users by the audit log's entries. The keys are the id-s of the users, meanwhile the values are the users themselves.

webhooks : dict of (int, Webhook) items

A dictionary that contains the mentioned webhook by the audit log's entries. The keys are the id-s of the webhooks, meanwhile the values are the values themselves.

_data : dict of (str, object) items

Data to be sent to Discord when requesting an another audit log chunk. Contains some information, which are not stored by any attributes of the audit log iterator, these are the filtering user and event options.

_index : int

The next audit log entries index to yield.

_self_reference : None or WeakReferer to AuditLog

Weak reference to the audit log itself.

Properties

guild

Returns the audit log's guild.

Returns

guild : None, Guild

Methods

__new__(client, guild_id, ...)

Creates an audit log iterator with the given parameters.

This method is a coroutine.

ParameterTypeOptionalDefaultDescription
client

Client

The client, who will execute the api requests.

guild_id

Guild, int

The guild what's audit logs will be requested.

user

None, ClientUserBase, int

None

Whether the audit logs should be filtered only to those, which were created by the given user.

entry_type

None, AuditLogEntryType, int

None

Whether the audit logs should be filtered only on the given event.

Raises

TypeError

  • If guild was not given neither as Guild, nor as int.
  • If user was not given neither as None, ClientUserBase nor as int.
  • If entry_type as not not given neither as None, AuditLogEntryType nor as int.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

load_all()

Loads all not yet loaded audit logs of the audit log iterator's guild.

This method is a coroutine.

transform()

Converts the audit log iterator to an audit log object.

Returns

audit_log : AuditLog

_get_self_reference()

_populate(data)

Populates the audit log entry with the given data.

ParameterTypeDescription
data

dict(str, object) items

Audit log data.

Returns

populated : bool

Whether any entry was added to the audit log.

__aiter__()

Returns self and resets the .index.

__anext__()

Yields the next entry of the audit log iterator.

This method is a coroutine.

__getattr__()

Drops a rich attribute error.

__getitem__()

Returns the specific audit log entry at the given index.

__iter__()

Iterates over the audit log's entries.

__len__()

Returns the amount of entries that the audit lgo contain.

__repr__()

Returns the representation of the Audit log.

__reversed__()

Reversed iterator over the audit log's entries.