Alchemy.AuditLog (alchemy v0.7.0)
This module contains functions and types related to audit logs.
Link to this section Summary
Types
An enumeration of action types.
The type of an audit log change.
An entry in an audit log.
Additional information fields in an audit log based on action_type.
Represents the Audit Log information of a guild.
Functions
Returns an audit log entry for a guild.
Link to this section Types
action()
Specs
action() :: :guild_update | :channel_create | :channel_update | :channel_delete | :channel_overwrite_create | :channel_overwrite_update | :channel_overwrite_delete | :member_kick | :member_prune | :member_ban_add | :member_ban_remove | :member_update | :member_role_update | :role_create | :role_update | :role_delete | :invite_create | :invite_update | :invite_delete | :webhook_create | :webhook_update | :webhook_delete | :emoji_create | :emoji_update | :message_delete
An enumeration of action types.
change()
Specs
The type of an audit log change.
new_valueThe new value after the change.old_valueThe value prior to the change.keyThe type of change that occurred. This also dictates the type ofnew_valueandold_value
entry()
Specs
entry() :: %Alchemy.AuditLog.Entry{
action_type: action(),
changes: [change()],
id: snowflake(),
options: options(),
reason: term(),
target_id: String.t(),
user_id: snowflake()
}
An entry in an audit log.
target_idThe id of the affected entity.changesThe changes made to thetarget_id.user_idThe user who made the changes.idThe id of the entryaction_typeThe type of action that occurredoptionsAdditional map of information for certain action types.reasonThe reason for the change
options()
Specs
options() :: %{
optional(:delete_member_days) => String.t(),
optional(:members_removed) => String.t(),
optional(:channel_id) => snowflake(),
optional(:count) => integer(),
optional(:id) => snowflake(),
optional(:type) => String.t(),
optional(:role_name) => String.t()
}
Additional information fields in an audit log based on action_type.
:member_prune -> [:delete_member_days, :members_removed]
:message_delete -> [:channel_id, :count]
:channel_overwrite_create | delete | update -> [:id, :type, :role_name]
snowflake()
Specs
snowflake() :: String.t()
Specs
t() :: %Alchemy.AuditLog{
audit_log_entries: [entry()],
users: Alchemy.User.t(),
webhooks: Alchemy.Webhook.t()
}
Represents the Audit Log information of a guild.
webhooksList of webhooks found in the Audit Log.userList of users found in the Audit Log.audit_log_entriesList of entries in the Audit Log.
Link to this section Functions
get_guild_log(guild, options \\ [])
Specs
get_guild_log(snowflake(), user_id: snowflake(), action_type: action(), before: snowflake(), limit: integer() ) :: {:ok, t()} | {:error, term()}
Returns an audit log entry for a guild.
Requires :view_audit_log permission.
Options
user_idFilters the log for a user id.action_typeThe type of audit log eventbeforeFilter the log before a certain entry id.limitHow many entries are returned (default 50, between 1 and 100).