net.dv8tion.jda.api.audit.AuditLogKey Maven / Gradle / Ivy
Show all versions of JDA Show documentation
/*
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dv8tion.jda.api.audit;
import net.dv8tion.jda.annotations.DeprecatedSince;
import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.automod.AutoModRule;
import net.dv8tion.jda.api.entities.automod.AutoModTriggerType;
import net.dv8tion.jda.api.entities.channel.Channel;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.attribute.ICategorizableChannel;
import net.dv8tion.jda.api.entities.channel.attribute.ISlowmodeChannel;
import net.dv8tion.jda.api.entities.channel.attribute.IThreadContainer;
import net.dv8tion.jda.api.entities.channel.concrete.ForumChannel;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel;
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji;
import net.dv8tion.jda.api.entities.sticker.GuildSticker;
import net.dv8tion.jda.internal.utils.EntityString;
/**
* Enum of possible/expected keys that can be provided
* to {@link AuditLogEntry#getChangeByKey(AuditLogKey) AuditLogEntry.getChangeByKey(AuditLogEntry.AuditLogKey}.
*
* Each constant in this enum has elaborate documentation on expected values for the
* returned {@link AuditLogChange AuditLogChange}.
*
There is no guarantee that the resulting type is accurate or that the value selected is not {@code null}!
*
* @see Audit Log Change Key
*/
public enum AuditLogKey
{
/**
* This is sometimes visible for {@link ActionType ActionTypes}
* which create a new entity.
*
Use with designated {@code getXById} method.
*
*
Expected type: String
*/
ID("id"),
/**
* Entity type (like channel type or webhook type)
*
*
Expected type: String or int
*/
TYPE("type"),
/**
* The id for an authorized application (webhook/bot/integration)
*
*
Expected type: String
*/
APPLICATION_ID("application_id"),
// GUILD
/**
* Change for the {@link net.dv8tion.jda.api.entities.Guild#getName() Guild.getName()} value
*
*
Expected type: String
*/
GUILD_NAME("name"),
/**
* Change of User ID for the owner of a {@link net.dv8tion.jda.api.entities.Guild Guild}
*
*
Expected type: String
*/
GUILD_OWNER("owner_id"),
/**
* Change of region represented by a key.
*
Use with {@link net.dv8tion.jda.api.Region#fromKey(String) Region.fromKey(String)}
*
*
Expected type: String
*/
GUILD_REGION("region"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild.Timeout AFKTimeout} of a Guild.
*
Use with {@link net.dv8tion.jda.api.entities.Guild.Timeout#fromKey(int) Timeout.fromKey(int)}
*
*
Expected type: Integer
*/
GUILD_AFK_TIMEOUT("afk_timeout"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getAfkChannel() Guild.getAfkChannel()} value represented by a VoiceChannel ID.
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getVoiceChannelById(String) Guild.getVoiceChannelById(String)}
*
*
Expected type: String
*/
GUILD_AFK_CHANNEL("afk_channel_id"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getSystemChannel() Guild.getSystemChannel()} value represented by a TextChannel ID.
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)}
*
*
Expected type: String
*/
GUILD_SYSTEM_CHANNEL("system_channel_id"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getRulesChannel() Guild.getRulesChannel()} value represented by a TextChannel ID.
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)}
*
*
Expected type: String
*/
GUILD_RULES_CHANNEL("rules_channel_id"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getCommunityUpdatesChannel() Guild.getCommunityUpdatesChannel()} value represented by a TextChannel ID.
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)}
*
*
Expected type: String
*/
GUILD_COMMUNITY_UPDATES_CHANNEL("public_updates_channel_id"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getExplicitContentLevel() Guild.getExplicitContentLevel()} of a Guild.
*
Use with {@link net.dv8tion.jda.api.entities.Guild.ExplicitContentLevel#fromKey(int) Guild.ExplicitContentLevel.fromKey(int)}
*
*
Expected type: Integer
*/
GUILD_EXPLICIT_CONTENT_FILTER("explicit_content_filter"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getIconId() Icon ID} of a Guild.
*
*
Expected type: String
*/
GUILD_ICON("icon_hash"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getSplashId() Splash ID} of a Guild.
*
*
Expected type: String
*/
GUILD_SPLASH("splash_hash"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getVerificationLevel() Guild.getVerificationLevel()} value.
*
Use with {@link net.dv8tion.jda.api.entities.Guild.VerificationLevel#fromKey(int) Guild.VerificationLevel.fromKey(int)}
*
*
Expected type: Integer
*/
GUILD_VERIFICATION_LEVEL("verification_level"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getDefaultNotificationLevel() Guild.getDefaultNotificationLevel()} value.
*
Use with {@link net.dv8tion.jda.api.entities.Guild.NotificationLevel#fromKey(int) Guild.NotificationLevel.fromKey(int)}
*
*
Expected type: Integer
*/
GUILD_NOTIFICATION_LEVEL("default_message_notifications"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Guild#getRequiredMFALevel() Guild.getRequiredMFALevel()} value
*
Use with {@link net.dv8tion.jda.api.entities.Guild.MFALevel#fromKey(int) Guild.MFALevel.fromKey(int)}
*
*
Expected type: Integer
*/
GUILD_MFA_LEVEL("mfa_level"),
/**
* Change of the {@link Guild#getVanityCode()} value.
*
*
Expected type: String
*/
GUILD_VANITY_URL_CODE("vanity_url_code"),
/**
* Days of inactivity for a prune event.
*
*
Expected type: Integer
*/
GUILD_PRUNE_DELETE_DAYS("prune_delete_days"),
/**
* Whether the guild widget is disabled or enabled
*
*
Expected type: Boolean
*/
GUILD_WIDGET_ENABLED("widget_enabled"),
/**
* The target channel for a widget
*
*
Expected type: String
*/
GUILD_WIDGET_CHANNEL_ID("widget_channel_id"),
// CHANNEL
/**
* Change of the {@link GuildChannel#getName() GuildChannel.getName()} value.
*
*
Expected type: String
*/
CHANNEL_NAME("name"),
/**
* Change of the {@link Channel#getFlags() flags} value.
*
*
Expected type: Integer
*/
CHANNEL_FLAGS("flags"),
/**
* Change of the {@link ICategorizableChannel#getParentCategory()} ICategorizable.getParentCategory()} value.
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getCategoryById(String) Guild.getCategoryById(String)}
*
*
Expected type: String
*/
CHANNEL_PARENT("parent_id"),
/**
* Change of the {@link TextChannel#getTopic() TextChannel.getTopic()} value.
*
Only for {@link ChannelType#TEXT ChannelType.TEXT}
*
*
Expected type: String
*/
CHANNEL_TOPIC("topic"),
/**
* Change of the {@link ISlowmodeChannel#getSlowmode()} value.
*
*
Expected type: Integer
*/
CHANNEL_SLOWMODE("rate_limit_per_user"),
/**
* Change of the {@link IThreadContainer#getDefaultThreadSlowmode()} value.
*
*
Expected type: Integer
*/
CHANNEL_DEFAULT_THREAD_SLOWMODE("default_thread_rate_limit_per_user"),
/**
* Change of the {@link ForumChannel#getDefaultReaction()} value.
*
*
Expected type: Map containing {@code emoji_id} and {@code emoji_name}
*/
CHANNEL_DEFAULT_REACTION_EMOJI("default_reaction_emoji"),
/**
* Change of the {@link VoiceChannel#getBitrate() VoiceChannel.getBitrate()} value.
*
Only for {@link ChannelType#VOICE ChannelType.VOICE}
*
*
Expected type: Integer
*/
CHANNEL_BITRATE("bitrate"),
/**
* Change of the {@link VoiceChannel#getUserLimit() VoiceChannel.getUserLimit()} value.
*
Only for {@link ChannelType#VOICE ChannelType.VOICE}
*
*
Expected type: Integer
*/
CHANNEL_USER_LIMIT("user_limit"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.channel.attribute.IAgeRestrictedChannel#isNSFW() IAgeRestrictedChannel.isNSFW()} value.
*
*
Expected type: Boolean
*/
CHANNEL_NSFW("nsfw"),
/**
* Change of the {@link net.dv8tion.jda.api.Region Region} value.
*
Only for {@link ChannelType#VOICE ChannelType.VOICE} and {@link ChannelType#STAGE ChannelType.STAGE}
*
*
Expected type: String
*/
CHANNEL_REGION("rtc_region"),
/**
* The integer type of this channel.
*
Use with {@link ChannelType#fromId(int) ChannelType.fromId(int)}.
*
* Expected type: int
*/
CHANNEL_TYPE("type"),
/**
* The overrides for this channel.
*
*
Expected type: List{@literal
*/
CHANNEL_OVERRIDES("permission_overwrites"),
/**
* The available tags of this {@link net.dv8tion.jda.api.entities.channel.concrete.ForumChannel ForumChannel}.
*
*
Expected type: List{@literal
*/
CHANNEL_AVAILABLE_TAGS("available_tags"),
/**
* The relevant channel for the audit log entry.
*
*
Expected type: String
*/
CHANNEL_ID("channel_id"),
/**
* The {@link ForumChannel#getDefaultSortOrder()} value.
*
Only for {@link ChannelType#FORUM} and {@link ChannelType#MEDIA}.
*
*
Expected type: Integer
*/
CHANNEL_DEFAULT_SORT_ORDER("default_sort_order"),
/**
* The {@link ForumChannel#getDefaultLayout()} value.
*
Only for {@link ChannelType#FORUM}.
*
*
Expected type: Integer
*/
DEFAULT_FORUM_LAYOUT("default_forum_layout"),
// THREADS
/**
* Change of the {@link ThreadChannel#getName() ThreadChannel.getName()} value.
*
*
Expected type: String
*/
THREAD_NAME("name"),
/**
* Change of the {@link ISlowmodeChannel#getSlowmode()} value.
*
*
Expected type: Integer
*
* @deprecated Use {@link #CHANNEL_SLOWMODE} instead
*/
@Deprecated
@ForRemoval
@DeprecatedSince("5.0.0")
@ReplaceWith("CHANNEL_SLOWMODE")
THREAD_SLOWMODE("rate_limit_per_user"),
/**
* Change of the {@link ThreadChannel#getAutoArchiveDuration() ThreadChannel.getAutoArchiveDuration()} value.
*
*
Expected type: Integer
*/
THREAD_AUTO_ARCHIVE_DURATION("auto_archive_duration"),
/**
* Change of the {@link ThreadChannel#isArchived() ThreadChannel.isArchived()} value.
*
*
Expected type: Boolean
*/
THREAD_ARCHIVED("archived"),
/**
* Change of the {@link ThreadChannel#isLocked() ThreadChannel.isLocked()} value.
*
*
Expected type: Boolean
*/
THREAD_LOCKED("locked"),
/**
* Change of the {@link ThreadChannel#isInvitable() ThreadChannel.isInvitable()} value.
* This can only be set/modified on a {@link ThreadChannel#isPublic() private thread}.
*
*
Expected type: Boolean
*/
THREAD_INVITABLE("invitable"),
/**
* The applied tags of this {@link ThreadChannel}, given that it is a forum post.
*
*
Expected type: List{@literal }
*/
THREAD_APPLIED_TAGS("applied_tags"),
// STAGE_INSTANCE
/**
* Change of the {@link net.dv8tion.jda.api.entities.StageInstance#getPrivacyLevel() StageInstance.getPrivacyLevel()} value
*
Use with {@link net.dv8tion.jda.api.entities.StageInstance.PrivacyLevel#fromKey(int) StageInstance.PrivacyLevel.fromKey(int)}
*
*
Expected type: Integer
*/
PRIVACY_LEVEL("privacy_level"),
// MEMBER
/**
* Change of the {@link net.dv8tion.jda.api.entities.Member#getNickname() Member.getNickname()} value
*
*
Expected type: String
*/
MEMBER_NICK("nick"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Member#getVoiceState() GuildVoiceState} of a Member.
*
Indicating that the {@link net.dv8tion.jda.api.entities.GuildVoiceState#isGuildMuted() Guild.isGuildMuted()} value updated.
*
*
Expected type: Boolean
*/
MEMBER_MUTE("mute"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Member#getVoiceState() GuildVoiceState} of a Member.
*
Indicating that the {@link net.dv8tion.jda.api.entities.GuildVoiceState#isGuildDeafened() Guild.isGuildDeafened()} value updated.
*
*
Expected type: Boolean
*/
MEMBER_DEAF("deaf"),
/**
* Roles added to {@link net.dv8tion.jda.api.entities.Member#getRoles() Member.getRoles()} with this action
*
Containing a list of {@link net.dv8tion.jda.api.entities.Role Role} IDs
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getRoleById(String) Guild.getRoleById(String)}
*
*
Expected type: List{@literal }
*/
MEMBER_ROLES_ADD("$add"),
/**
* Roles removed from {@link net.dv8tion.jda.api.entities.Member#getRoles() Member.getRoles()} with this action
*
Containing a list of {@link net.dv8tion.jda.api.entities.Role Role} IDs
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getRoleById(String) Guild.getRoleById(String)}
*
*
Expected type: List{@literal }
*/
MEMBER_ROLES_REMOVE("$remove"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Member#getTimeOutEnd() Time out} of a Member.
*
Indicating that the {@link net.dv8tion.jda.api.entities.Member#getTimeOutEnd() Member.getTimeOutEnd()} value updated.
*
This is provided as an ISO8601 Date-Time string.
*
*
Expected type: String
*/
MEMBER_TIME_OUT("communication_disabled_until"),
// PERMISSION OVERRIDE
/**
* Modified raw denied permission bits
*
Similar to the value returned by {@link net.dv8tion.jda.api.entities.PermissionOverride#getDeniedRaw() PermissionOverride.getDeniedRaw()}
*
Use with {@link net.dv8tion.jda.api.Permission#getPermissions(long) Permission.getPermissions(long)}
*
*
Expected type: long
*/
OVERRIDE_DENY("deny"),
/**
* Modified raw allowed permission bits
*
Similar to the value returned by {@link net.dv8tion.jda.api.entities.PermissionOverride#getAllowedRaw() PermissionOverride.getAllowedRaw()}
*
Use with {@link net.dv8tion.jda.api.Permission#getPermissions(long) Permission.getPermissions(long)}
*
*
Expected type: long
*/
OVERRIDE_ALLOW("allow"),
/**
* The string type of this override.
*
{@code "role"} or {@code "member"}.
*
*
Expected type: String
*/
OVERRIDE_TYPE("type"),
// ROLE
/**
* Change of the {@link net.dv8tion.jda.api.entities.Role#getName() Role.getName()} value.
*
*
Expected type: String
*/
ROLE_NAME("name"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Role#getPermissionsRaw() Role.getPermissionsRaw()} value.
*
Use with {@link net.dv8tion.jda.api.Permission#getPermissions(long) Permission.getPermissions(long)}
*
*
Expected type: Long
*/
ROLE_PERMISSIONS("permissions"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Role#getColor() Role.getColor()} value.
*
Use with {@link java.awt.Color#Color(int) Color(int)}
*
*
Expected type: Integer
*/
ROLE_COLOR("color"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Role#isHoisted() Role.isHoisted()} value.
*
*
Expected type: Boolean
*/
ROLE_HOISTED("hoist"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Role#isMentionable() Role.isMentionable()} value.
*
*
Expected type: Boolean
*/
ROLE_MENTIONABLE("mentionable"),
// EMOJI
/**
* Change of the {@link RichCustomEmoji#getName() Emoji.getName()} value.
*
*
Expected type: String
*/
EMOJI_NAME("name"),
/**
* Roles added to {@link RichCustomEmoji#getRoles() RichCustomEmoji.getRoles()} with this action
*
Containing a list of {@link net.dv8tion.jda.api.entities.Role Role} IDs
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getRoleById(String) Guild.getRoleById(String)}
*
*
Expected type: List{@literal }
*/
EMOJI_ROLES_ADD("$add"),
/**
* Roles remove from {@link RichCustomEmoji#getRoles() RichCustomEmoji.getRoles()} with this action
*
Containing a list of {@link net.dv8tion.jda.api.entities.Role Role} IDs
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getRoleById(String) Guild.getRoleById(String)}
*
*
Expected type: List{@literal }
*/
EMOJI_ROLES_REMOVE("$remove"),
// STICKER
/**
* Change of the {@link GuildSticker#getName() Sticker.getName()} value.
*
*
Expected type: String
*/
STICKER_NAME("name"),
/**
* Change of the {@link GuildSticker#getFormatType() Sticker.getFormatType()} value.
*
*
Expected type: String
*/
STICKER_FORMAT("format_type"),
/**
* Change of the {@link GuildSticker#getDescription() Sticker.getDescription()} value.
*
*
Expected type: String
*/
STICKER_DESCRIPTION("description"),
/**
* Change of the {@link GuildSticker#getTags() Sticker.getTags()} value.
*
*
Expected type: String
*/
STICKER_TAGS("tags"),
// WEBHOOK
/**
* Change of the {@link net.dv8tion.jda.api.entities.Webhook#getName() Webhook.getName()} value.
*
*
Expected type: String
*/
WEBHOOK_NAME("name"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Webhook#getDefaultUser() Webhook.getDefaultUser()}'s avatar hash of a Webhook.
*
This is used to build the {@link net.dv8tion.jda.api.entities.User#getAvatarUrl() User.getAvatarUrl()}!
*
*
Expected type: String
*/
WEBHOOK_ICON("avatar_hash"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Webhook#getChannel() Webhook.getChannel()} for
* the target {@link net.dv8tion.jda.api.entities.Webhook Webhook}
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)}
*
*
Expected type: String
*/
WEBHOOK_CHANNEL("channel_id"),
// INVITE
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#getCode() Invite.getCode()} for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
Use with {@link net.dv8tion.jda.api.entities.Invite#resolve(net.dv8tion.jda.api.JDA, String)} Invite.resolve(JDA, String)}
*
*
Expected type: String
*/
INVITE_CODE("code"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#getMaxAge() Invite.getMaxAge()} for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
*
Expected type: int
*/
INVITE_MAX_AGE("max_age"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#isTemporary() Invite.isTemporary()} for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
*
Expected type: boolean
*/
INVITE_TEMPORARY("temporary"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#getInviter() Invite.getInviter()} ID for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
Use with {@link net.dv8tion.jda.api.JDA#getUserById(String) JDA.getUserById(String)}
*
*
Expected type: String
*/
INVITE_INVITER("inviter"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#getChannel() Invite.getChannel()} ID for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
Use with {@link net.dv8tion.jda.api.JDA#getTextChannelById(String) JDA.getTextChannelById(String)}
* or {@link net.dv8tion.jda.api.JDA#getVoiceChannelById(String) JDA.getVoiceChannelById(String)}
*
*
Expected type: String
*/
INVITE_CHANNEL("channel_id"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#getUses() Invite.getUses()} for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
*
Expected type: int
*/
INVITE_USES("uses"),
/**
* Change of the {@link net.dv8tion.jda.api.entities.Invite#getMaxUses() Invite.getMaxUses()} for
* the target {@link net.dv8tion.jda.api.entities.Invite Invite}
*
*
Expected type: int
*/
INVITE_MAX_USES("max_uses"),
// AUTO MODERATION
/**
* Change of the {@link AutoModRule#getName()} for the target {@link AutoModRule}
*
*
Expected type: String
*/
AUTO_MODERATION_RULE_NAME("auto_moderation_rule_name"),
/**
* The {@link AutoModRule#getTriggerType()} for an {@link AutoModRule} trigger
*
*
Use with {@link AutoModTriggerType#fromKey(int)}
*
*
Expected type: int
*/
AUTO_MODERATION_RULE_TRIGGER_TYPE("auto_moderation_rule_trigger_type"),
;
private final String key;
AuditLogKey(String key)
{
this.key = key;
}
public String getKey()
{
return key;
}
@Override
public String toString()
{
return new EntityString(this)
.setType(this)
.addMetadata("key", key)
.toString();
}
}