hikari.audit_logs#

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

Module Contents#

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.

class hikari.audit_logs.AuditLogChange[source]#

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

key: AuditLogChangeKey | str[source]#

The name of the audit log change’s key.

new_value: Any | None[source]#

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

old_value: Any | None[source]#

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

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.

ADD_ROLE_TO_MEMBER = '$add'[source]#

Role added to a member.

AFK_CHANNEL_ID = 'afk_channel_id'[source]#

Afk Channel ID.

AFK_TIMEOUT = 'afk_timeout'[source]#

Afk Timeout.

ALLOW = 'allow'[source]#

Allow.

APPLICATION_ID = 'application_id'[source]#

Application ID.

ARCHIVED = 'archived'[source]#

Archived.

ASSETS = 'asset'[source]#

Asset.

AUTO_ARCHIVE_DURATION = 'auto_archive_duration'[source]#

Auto Archive Duration.

AVAILABLE = 'available'[source]#

Available.

AVATAR_HASH = 'avatar_hash'[source]#

Avatar Hash.

BANNER_HASH = 'banner_hash'[source]#

Banner Hash.

BITRATE = 'bitrate'[source]#

Bitrate.

CHANNEL_ID = 'channel_id'[source]#

Channel ID.

COLOR = 'color'[source]#

Color.

COLOUR[source]#

Alias for COLOR.

COMMAND_ID = 'command_id'[source]#

Command ID.

DEAF = 'deaf'[source]#

Deaf.

DEFAULT_AUTO_ARCHIVE_DURATION = 'default_auto_archive_duration'[source]#

Default Auto Archive Duration.

DEFAULT_MESSAGE_NOTIFICATIONS = 'default_message_notifications'[source]#

Default Message Notifications.

DENY = 'deny'[source]#

Deny.

DESCRIPTION = 'description'[source]#

Description.

DISCOVERY_SPLASH_HASH = 'discovery_splash_hash'[source]#

Discovery Splash Hash.

ENABLE_EMOTICONS = 'enable_emoticons'[source]#

Enable Emoticons.

EXPIRE_BEHAVIOR = 'expire_behavior'[source]#

Expire Behavior.

EXPIRE_GRACE_PERIOD = 'expire_grace_period'[source]#

Expire Grace Period.

EXPLICIT_CONTENT_FILTER = 'explicit_content_filter'[source]#

Explicit Content Filter.

FORMAT_TYPE = 'format_type'[source]#

Format Type.

GUILD_ID = 'guild_id'[source]#

Guild ID.

HOIST = 'hoist'[source]#

Hoist.

ICON_HASH = 'icon_hash'[source]#

Icon Hash.

ID = 'id'[source]#

ID.

INVITABLE = 'invitable'[source]#

Invitable.

INVITER_ID = 'inviter_id'[source]#

Inviter ID.

INVITE_CODE = 'code'[source]#

Code.

LOCKED = 'locked'[source]#

Locked.

MAX_AGE = 'max_age'[source]#

Max Age.

MAX_USES = 'max_uses'[source]#

Max Uses.

MENTIONABLE = 'mentionable'[source]#

Mentionable.

MFA_LEVEL = 'mfa_level'[source]#

Mfa Level.

MUTE = 'mute'[source]#

Mute.

NAME = 'name'[source]#

Name.

NICK = 'nick'[source]#

Nick.

NSFW = 'nsfw'[source]#

Nsfw.

OWNER_ID = 'owner_id'[source]#

Owner ID.

PERMISSIONS = 'permissions'[source]#

Permissions.

PERMISSION_OVERWRITES = 'permission_overwrites'[source]#

Permission Overwrites.

POSITION = 'position'[source]#

Position.

PREFERRED_LOCALE = 'preferred_locale'[source]#

Preferred Locale.

PRUNE_DELETE_DAYS = 'prune_delete_days'[source]#

Prune Delete Days.

PUBLIC_UPDATES_CHANNEL_ID = 'public_updates_channel_id'[source]#

Public Updates Channel ID.

RATE_LIMIT_PER_USER = 'rate_limit_per_user'[source]#

Rate Limit Per User.

REGION = 'region'[source]#

Region.

REMOVE_ROLE_FROM_MEMBER = '$remove'[source]#

Role removed from a member.

RTC_REGION = 'rtc_region'[source]#

RTC Region.

RULES_CHANNEL_ID = 'rules_channel_id'[source]#

Rules Channel ID.

SPLASH_HASH = 'splash_hash'[source]#

Splash Hash.

SYSTEM_CHANNEL_ID = 'system_channel_id'[source]#

System Channel ID.

TAGS = 'tags'[source]#

Tags.

TEMPORARY = 'temporary'[source]#

Temporary.

TOPIC = 'topic'[source]#

Topic.

TYPE = 'type'[source]#

Type.

USER_LIMIT = 'user_limit'[source]#

User Limit.

USES = 'uses'[source]#

Uses.

VANITY_URL_CODE = 'vanity_url_code'[source]#

Vanity Url Code.

VERIFICATION_LEVEL = 'verification_level'[source]#

Verification Level.

WIDGET_CHANNEL_ID = 'widget_channel_id'[source]#

Widget Channel ID.

WIDGET_ENABLED = 'widget_enabled'[source]#

Widget Enabled.

class hikari.audit_logs.AuditLogEntry[source]#

Bases: hikari.snowflakes.Unique

Represents an entry in a guild’s audit log.

action_type: AuditLogEventType | int[source]#

The type of action this entry represents.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

changes: Sequence[AuditLogChange][source]#

A sequence of the changes made to AuditLogEntry.target_id.

guild_id: hikari.snowflakes.Snowflake[source]#

ID of the guild this audit log entry is for.

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

options: BaseAuditLogEntryInfo | None[source]#

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

reason: str | None[source]#

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

target_id: hikari.snowflakes.Snowflake | None[source]#

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

user_id: hikari.snowflakes.Snowflake | None[source]#

The ID of the user who made this change.

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.InternalServerError

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

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.

role_name: str | None[source]#

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

type: hikari.channels.PermissionOverwriteType | str[source]#

The type of entity this overwrite targets.

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.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.InternalServerError

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

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.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.InternalServerError

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