Package net.dv8tion.jda.api.audit
Class AuditLogEntry
java.lang.Object
net.dv8tion.jda.api.audit.AuditLogEntry
- All Implemented Interfaces:
ISnowflake
Single entry for an
This entry contains all options/changes and details for the action that was logged by the
AuditLogPaginationAction
.
This entry contains all options/changes and details for the action that was logged by the
Guild
audit-logs.-
Constructor Summary
ConstructorDescriptionAuditLogEntry
(ActionType type, int rawType, long id, long userId, long targetId, net.dv8tion.jda.internal.entities.GuildImpl guild, net.dv8tion.jda.internal.entities.UserImpl user, net.dv8tion.jda.internal.entities.WebhookImpl webhook, String reason, Map<String, AuditLogChange> changes, Map<String, Object> options) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getChangeByKey
(String key) Shortcut to
lookup!getChanges()
.get(key)
This lookup is case-insensitive!Shortcut to
lookup!getChanges()
.get(key)
This lookup is case-insensitive!Key-ValueMap
containing allAuditLogChanges
made in this entry.@Unmodifiable List<AuditLogChange>
getChangesForKeys
(AuditLogKey... keys) Filters all changes by the specified keysgetGuild()
TheGuild
this audit-log entry refers tolong
The Snowflake id of this entity.getJDA()
The corresponding JDA instance of the referring Guild<T> T
getOption
(AuditLogOption option) Shortcut to
lookup!getOptions()
.get(name)<T> T
getOptionByName
(String name) Shortcut to
lookup!getOptions()
.get(name)
This lookup is case-insensitive!Key-ValueMap
containing all Options made in this entry.getOptions
(AuditLogOption... options) Constructs a filtered, immutable list of options corresponding to the providedAuditLogOptions
.The optional reason why this action was executed.The id for the target entity.long
The id for the target entity.TheTargetType
defining what kind of entity was targeted by this action.getType()
TheActionType
defining what auditable Action is referred to by this entry.int
The raw type value used to derivegetType()
.getUser()
TheUser
responsible for this action.The id for the user that executed the action.long
The id for the user that executed the action.TheWebhook
that the target id of this audit-log entry refers toint
hashCode()
toString()
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
Constructor Details
-
AuditLogEntry
public AuditLogEntry(ActionType type, int rawType, long id, long userId, long targetId, net.dv8tion.jda.internal.entities.GuildImpl guild, net.dv8tion.jda.internal.entities.UserImpl user, net.dv8tion.jda.internal.entities.WebhookImpl webhook, String reason, Map<String, AuditLogChange> changes, Map<String, Object> options)
-
-
Method Details
-
getIdLong
public long getIdLong()Description copied from interface:ISnowflake
The Snowflake id of this entity. This is unique to every entity and will never change.- Specified by:
getIdLong
in interfaceISnowflake
- Returns:
- Long containing the Id.
-
getTargetIdLong
public long getTargetIdLong()The id for the target entity.
This references an entity based on theTargetType
which is specified bygetTargetType()
!- Returns:
- The target id
-
getTargetId
The id for the target entity.
This references an entity based on theTargetType
which is specified bygetTargetType()
!- Returns:
- The target id
-
getWebhook
TheWebhook
that the target id of this audit-log entry refers to- Returns:
- Possibly-null Webhook instance
-
getGuild
TheGuild
this audit-log entry refers to- Returns:
- The Guild instance
-
getUserIdLong
public long getUserIdLong()The id for the user that executed the action.- Returns:
- The user id
-
getUserId
The id for the user that executed the action.- Returns:
- The user id
-
getUser
TheUser
responsible for this action.This will not be available for
GuildAuditLogEntryCreateEvent
, you can usegetUserIdLong()
instead.- Returns:
- Possibly-null User instance
-
getReason
The optional reason why this action was executed.- Returns:
- Possibly-null reason String
-
getJDA
The corresponding JDA instance of the referring Guild- Returns:
- The corresponding JDA instance
-
getChanges
Key-ValueMap
containing allAuditLogChanges
made in this entry. The keys for the returned map are case-insensitive keys defined in the regarding AuditLogChange value.
To iterate only the changes you can useMap.values()
!- Returns:
- Key-Value Map of changes
-
getChangeByKey
Shortcut to
lookup!getChanges()
.get(key)
This lookup is case-insensitive!- Parameters:
key
- TheAuditLogKey
to look for- Returns:
- Possibly-null value corresponding to the specified key
-
getChangeByKey
Shortcut to
lookup!getChanges()
.get(key)
This lookup is case-insensitive!- Parameters:
key
- The key to look for- Returns:
- Possibly-null value corresponding to the specified key
-
getChangesForKeys
Filters all changes by the specified keys- Parameters:
keys
- VarargsAuditLogKeys
to look for- Returns:
- Possibly-empty, never-null immutable list of
AuditLogChanges
- Throws:
IllegalArgumentException
- If provided with null array
-
getOptions
Key-ValueMap
containing all Options made in this entry. The keys for the returned map are case-insensitive keys defined in the regarding AuditLogChange value.
To iterate only the changes you can useMap.values()
!Options may include secondary targets or details that do not qualify as "change".
An example of that would be themember
option forCHANNEL_OVERRIDE_UPDATE
containing the user_id of aMember
.- Returns:
- Key-Value Map of changes
-
getOptionByName
Shortcut to
lookup!getOptions()
.get(name)
This lookup is case-insensitive!- Type Parameters:
T
- The expected type for this option
Will be used for casting- Parameters:
name
- The field name to look for- Returns:
- Possibly-null value corresponding to the specified key
- Throws:
ClassCastException
- If the type-cast failed for the generic type.
-
getOption
Shortcut to
lookup!getOptions()
.get(name)- Type Parameters:
T
- The expected type for this option
Will be used for casting- Parameters:
option
- TheAuditLogOption
- Returns:
- Possibly-null value corresponding to the specified option constant
- Throws:
ClassCastException
- If the type-cast failed for the generic type.IllegalArgumentException
- If provided withnull
option.
-
getOptions
Constructs a filtered, immutable list of options corresponding to the providedAuditLogOptions
.
This will exclude options withnull
values!- Parameters:
options
- The not-nullAuditLogOptions
which will be used to gather option values viagetOption(AuditLogOption)
!- Returns:
- Unmodifiable list of representative values
- Throws:
IllegalArgumentException
- If provided with null options
-
getType
TheActionType
defining what auditable Action is referred to by this entry.- Returns:
- The
ActionType
-
getTypeRaw
public int getTypeRaw()The raw type value used to derivegetType()
.
This can be used when a new action type is not yet supported by JDA.- Returns:
- The raw type value
-
getTargetType
TheTargetType
defining what kind of entity was targeted by this action.
Shortcut forgetType().getTargetType()
- Returns:
- The
TargetType
-
hashCode
public int hashCode() -
equals
-
toString
-