Settings Perm Check
This commit is contained in:
parent
76e0ef0988
commit
5fb96f276a
|
@ -6,6 +6,7 @@ import moe.oko.Kiafumi.util.CommandInfo;
|
|||
import moe.oko.Kiafumi.util.CommandType;
|
||||
import moe.oko.Kiafumi.util.EmbedUI;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
|
||||
|
@ -41,6 +42,12 @@ public class SettingCommand extends CommandClass {
|
|||
e.getHook().sendMessageEmbeds(eb.build()).queue();
|
||||
return;
|
||||
case "setting":
|
||||
//User is attempting a settings modification. Check if admin.
|
||||
if(!e.getMember().hasPermission(Permission.ADMINISTRATOR) && !e.getMember().isOwner()) {
|
||||
e.deferReply(true).queue();
|
||||
//Private reply, other people can't see this if ephemeral.
|
||||
e.getHook().sendMessage("**You cannot run this command**").queue();
|
||||
}
|
||||
switch(e.getSubcommandName().toLowerCase()) {
|
||||
case "view":
|
||||
e.deferReply().queue();
|
||||
|
|
Loading…
Reference in a new issue