hikari.audit_logs#

Application and entities that are used to describe audit logs on Discord.

Module Contents#

class hikari.audit_logs.AuditLogChangeKey[source]#

Bases: str, hikari.internal.enums.Enum

Commonly known and documented keys for audit log change objects.

Others may exist. These should be expected to default to the raw string Discord provided us. These are defined for documentation purposes and can be treated as regular strings for all other purposes.

COLOUR[source]#

Alias for COLOR.

class hikari.audit_logs.AuditLogChange[source]#

Represents a change made to an audit log entry’s target entity.

new_value: Optional[Any][source]#

The new value of the key, if something was added or changed.

old_value: Optional[Any][source]#

The old value of the key, if something was removed or changed.

key: Union[AuditLogChangeKey, str][source]#

The name of the audit log change’s key.

class hikari.audit_logs.AuditLogEventType[source]#

Bases: int, hikari.internal.enums.Enum

The type of event that occurred.

class hikari.audit_logs.BaseAuditLogEntryInfo[source]#

Bases: abc.ABC

A base object that all audit log entry info objects will inherit from.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

class hikari.audit_logs.ChannelOverwriteEntryInfo[source]#

Bases: BaseAuditLogEntryInfo, hikari.snowflakes.Unique

Represents the extra information for overwrite related audit log entries.

Will be attached to the overwrite create, update and delete audit log entries.

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

type: Union[hikari.channels.PermissionOverwriteType, str][source]#

The type of entity this overwrite targets.

role_name: Optional[str][source]#

The name of the role this overwrite targets, if it targets a role.

class hikari.audit_logs.MessagePinEntryInfo[source]#

Bases: BaseAuditLogEntryInfo

The extra information for message pin related audit log entries.

Will be attached to the message pin and message unpin audit log entries.

channel_id: hikari.snowflakes.Snowflake[source]#

The ID of the text based channel where a pinned message is being targeted.

message_id: hikari.snowflakes.Snowflake[source]#

The ID of the message that’s being pinned or unpinned.

async fetch_channel()[source]#

Fetch The channel where this message was pinned or unpinned.

Returns
hikari.channels.TextableChannel

The channel where this message was pinned or unpinned.

Raises
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.RateLimitedError

Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

async fetch_message()[source]#

Fetch the object of the message that’s being pinned or unpinned.

Returns
hikari.messages.Message

The message that’s being pinned or unpinned.

Raises
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel that the message is in.

hikari.errors.NotFoundError

If the message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.RateLimitedError

Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

class hikari.audit_logs.MemberPruneEntryInfo[source]#

Bases: BaseAuditLogEntryInfo

Extra information attached to guild prune log entries.

delete_member_days: datetime.timedelta[source]#

The timedelta of how many days members were pruned for inactivity based on.

members_removed: int[source]#

The number of members who were removed by this prune.

class hikari.audit_logs.MessageBulkDeleteEntryInfo[source]#

Bases: BaseAuditLogEntryInfo

Extra information for the message bulk delete audit entry.

count: int[source]#

The amount of messages that were deleted.

class hikari.audit_logs.MessageDeleteEntryInfo[source]#

Bases: MessageBulkDeleteEntryInfo

Extra information attached to the message delete audit entry.

channel_id: hikari.snowflakes.Snowflake[source]#

The ID of guild text based channel where these message(s) were deleted.

async fetch_channel()[source]#

Fetch the guild text based channel where these message(s) were deleted.

Returns
hikari.channels.TextableGuildChannel

The guild text based channel where these message(s) were deleted.

Raises
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.RateLimitedError

Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

class hikari.audit_logs.MemberDisconnectEntryInfo[source]#

Bases: BaseAuditLogEntryInfo

Extra information for the voice chat member disconnect entry.

count: int[source]#

The amount of members who were disconnected from voice in this entry.

class hikari.audit_logs.MemberMoveEntryInfo[source]#

Bases: MemberDisconnectEntryInfo

Extra information for the voice chat based member move entry.

channel_id: hikari.snowflakes.Snowflake[source]#

The channel that the member(s) have been moved to.

async fetch_channel()[source]#

Fetch the guild voice based channel where the member(s) have been moved to.

Returns
hikari.channels.GuildVoiceChannel

The guild voice based channel where the member(s) have been moved to.

Raises
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.RateLimitedError

Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

class hikari.audit_logs.AuditLogEntry[source]#

Bases: hikari.snowflakes.Unique

Represents an entry in a guild’s audit log.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

target_id: Optional[hikari.snowflakes.Snowflake][source]#

The ID of the entity affected by this change, if applicable.

changes: Sequence[AuditLogChange][source]#

A sequence of the changes made to AuditLogEntry.target_id.

user_id: Optional[hikari.snowflakes.Snowflake][source]#

The ID of the user who made this change.

action_type: Union[AuditLogEventType, int][source]#

The type of action this entry represents.

options: Optional[BaseAuditLogEntryInfo][source]#

Extra information about this entry. Only be provided for certain event_type.

reason: Optional[str][source]#

The reason for this change, if set (between 0-512 characters).

async fetch_user()[source]#

Fetch the user who made this change.

Returns
typing.Optional[hikari.users.User]

The user who made this change, if available.

Raises
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the user is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.RateLimitedError

Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

class hikari.audit_logs.AuditLog[source]#

Bases: Sequence[AuditLogEntry]

Represents a guilds audit log’s page.

entries: Mapping[hikari.snowflakes.Snowflake, AuditLogEntry][source]#

A mapping of snowflake IDs to the audit log’s entries.

integrations: Mapping[hikari.snowflakes.Snowflake, hikari.guilds.PartialIntegration][source]#

A mapping of the partial objects of integrations found in this audit log.

threads: Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildThreadChannel][source]#

A mapping of the objects of threads found in this audit log.

users: Mapping[hikari.snowflakes.Snowflake, hikari.users.User][source]#

A mapping of the objects of users found in this audit log.

webhooks: Mapping[hikari.snowflakes.Snowflake, hikari.webhooks.PartialWebhook][source]#

A mapping of the objects of webhooks found in this audit log.