All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sx.blah.discord.handle.audit.entry.change.ChangeKey Maven / Gradle / Ivy

Go to download

A Java binding for the official Discord API, forked from the inactive https://github.com/nerd/Discord4J. Copyright (c) 2017, Licensed under GNU LGPLv3

The newest version!
/*
 *     This file is part of Discord4J.
 *
 *     Discord4J is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     Discord4J is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 *
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with Discord4J.  If not, see .
 */

package sx.blah.discord.handle.audit.entry.change;

import sx.blah.discord.Discord4J;
import sx.blah.discord.handle.obj.IRole;
import sx.blah.discord.handle.obj.PermissionOverride;
import sx.blah.discord.util.LogMarkers;

/**
 * The keys used in an {@link ChangeMap}. Use these with
 * {@link sx.blah.discord.handle.audit.entry.AuditLogEntry#getChangeByKey(ChangeKey)}.
 *
 * @param  The type of the value associated with the key.
 */
public final class ChangeKey {
	public static final ChangeKey NAME = newKey();
	public static final ChangeKey ICON_HASH = newKey();
	public static final ChangeKey SPLASH_HASH = newKey();
	public static final ChangeKey OWNER_ID = newKey();
	public static final ChangeKey REGION = newKey();
	public static final ChangeKey AFK_CHANNEL_ID = newKey();
	public static final ChangeKey AFK_TIMEOUT = newKey();
	public static final ChangeKey MFA_LEVEL = newKey();
	public static final ChangeKey VERIFICATION_LEVEL = newKey();
	public static final ChangeKey EXPLICIT_CONTENT_FILTER = newKey();
	public static final ChangeKey DEFAULT_MESSAGE_NOTIFICATIONS = newKey();
	public static final ChangeKey VANITY_URL_CODE = newKey();
	public static final ChangeKey $ADD = newKey();
	public static final ChangeKey $REMOVE = newKey();
	public static final ChangeKey PRUNE_DELETE_DAYS = newKey();
	public static final ChangeKey WIDGET_ENABLED = newKey();
	public static final ChangeKey WIDGET_CHANNEL_ID = newKey();
	public static final ChangeKey POSITION = newKey();
	public static final ChangeKey TOPIC = newKey();
	public static final ChangeKey BITRATE = newKey();
	public static final ChangeKey NSFW = newKey();
	public static final ChangeKey APPLICATION_ID = newKey();
	public static final ChangeKey PERMISSIONS = newKey();
	public static final ChangeKey COLOR = newKey();
	public static final ChangeKey HOIST = newKey();
	public static final ChangeKey MENTIONABLE = newKey();
	public static final ChangeKey ALLOW = newKey();
	public static final ChangeKey DENY = newKey();
	public static final ChangeKey CODE = newKey();
	public static final ChangeKey CHANNEL_ID = newKey();
	public static final ChangeKey INVITER_ID = newKey();
	public static final ChangeKey MAX_USES = newKey();
	public static final ChangeKey USES = newKey();
	public static final ChangeKey MAX_AGE = newKey();
	public static final ChangeKey TEMPORARY = newKey();
	public static final ChangeKey DEAF = newKey();
	public static final ChangeKey MUTE = newKey();
	public static final ChangeKey NICK = newKey();
	public static final ChangeKey AVATAR_HASH = newKey();
	public static final ChangeKey ID = newKey();
	public static final ChangeKey TYPE = newKey();
	public static final ChangeKey PERMISSION_OVERWRITES = newKey();

	public static ChangeKey fromRaw(String rawKey) {
		ChangeKey key = null;
		try {
			key = (ChangeKey) ChangeKey.class.getDeclaredField(rawKey.toUpperCase()).get(null);
		} catch (NoSuchFieldException | IllegalAccessException e) {
			Discord4J.LOGGER.error(LogMarkers.HANDLE, "Failed to find change key from raw string: {}", rawKey, e);
		}
		return key;
	}

	private static  ChangeKey newKey() {
		return new ChangeKey<>();
	}

	private ChangeKey() {

	}
}