net.dv8tion.jda.api.audit.AuditLogOption 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.internal.utils.EntityString;
import javax.annotation.Nonnull;
/**
* Enum constants for possible options
*
Providing detailed description of possible occasions and expected types.
*
* The expected types are not guaranteed to be accurate!
*
* @see Optional Audit Entry Info
*/
public enum AuditLogOption
{
/**
* Possible detail for
*
* - {@link ActionType#MESSAGE_DELETE}
* - {@link ActionType#MESSAGE_BULK_DELETE}
* - {@link ActionType#MEMBER_VOICE_KICK}
* - {@link ActionType#MEMBER_VOICE_MOVE}
*
* describing the amount of targeted entities.
*
Use with {@link Integer#parseInt(String)}.
*
* Expected type: String
*/
COUNT("count"),
/**
* Possible message id for actions of type {@link ActionType#MESSAGE_PIN} and {@link ActionType#MESSAGE_UNPIN}.
*
Use with {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel#retrieveMessageById(String)}.
*
*
Expected type: String
*/
MESSAGE("message_id"),
/**
* Possible secondary target of an {@link net.dv8tion.jda.api.audit.ActionType ActionType}
* such as:
*
* - {@link ActionType#MEMBER_VOICE_MOVE}
* - {@link ActionType#MESSAGE_PIN}
* - {@link ActionType#MESSAGE_UNPIN}
* - {@link ActionType#MESSAGE_DELETE}
*
* Use with {@link net.dv8tion.jda.api.entities.Guild#getGuildChannelById(String) Guild.getGuildChannelById(String)}.
*
* Expected type: String
*/
CHANNEL("channel_id"),
/**
* Possible secondary target of an {@link net.dv8tion.jda.api.audit.ActionType ActionType}
* such as {@link net.dv8tion.jda.api.audit.ActionType#CHANNEL_OVERRIDE_CREATE ActionType.CHANNEL_OVERRIDE_CREATE}
*
Use with {@link net.dv8tion.jda.api.JDA#getUserById(String) JDA.getUserById(String)}
*
*
Expected type: String
*/
USER("user_id"),
/**
* Possible secondary target of an {@link net.dv8tion.jda.api.audit.ActionType ActionType}
* such as {@link net.dv8tion.jda.api.audit.ActionType#CHANNEL_OVERRIDE_CREATE ActionType.CHANNEL_OVERRIDE_CREATE}
*
Use with {@link net.dv8tion.jda.api.entities.Guild#getRoleById(String) Guild.getRoleById(String)}
*
*
Expected type: String
*/
ROLE("role_id"),
/**
* Possible name of the role if the target type is {@link TargetType#ROLE}
*
*
*
Expected type: String
*/
ROLE_NAME("role_name"),
/**
* Possible option indicating the type of an entity.
*
Maybe for {@link net.dv8tion.jda.api.audit.ActionType#CHANNEL_OVERRIDE_CREATE ActionType.CHANNEL_OVERRIDE_CREATE}
* or {@link net.dv8tion.jda.api.audit.ActionType#CHANNEL_CREATE ActionType.CHANNEL_CREATE}.
*
*
Expected type: String or Integer
*
This type depends on the action taken place.
*/
TYPE("type"),
/**
* This is sometimes visible for {@link net.dv8tion.jda.api.audit.ActionType ActionTypes}
* which create a new entity.
*
Use with designated {@code getXById} method.
*
*
Expected type: String
*/
ID("id"),
/**
* Possible option of {@link net.dv8tion.jda.api.audit.ActionType#PRUNE ActionType.PRUNE}
* describing the period of inactivity for that prune.
*
*
Expected type: int
*/
DELETE_MEMBER_DAYS("delete_member_days"),
/**
* Possible option of {@link net.dv8tion.jda.api.audit.ActionType#PRUNE ActionType.PRUNE}
* describing the amount of kicked members for that prune.
*
*
Expected type: int
*/
MEMBERS_REMOVED("members_removed");
private final String key;
AuditLogOption(String key)
{
this.key = key;
}
/**
* Key used in {@link AuditLogEntry#getOptionByName(String) AuditLogEntry.getOptionByName(String)}
*
* @return Key for this option
*/
@Nonnull
public String getKey()
{
return key;
}
@Override
public String toString()
{
return new EntityString(this)
.setType(this)
.addMetadata("key", key)
.toString();
}
}