aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-04-13 15:32:31 -0700
committerPinapelz <donaldshan1@outlook.com>2023-04-13 15:32:31 -0700
commit1e576a1f5ba945f3f525d3e229c36429aceec1e2 (patch)
treebaf922b77d3876b8180efba4b307bb366139c0cf /src/main
parent795cbcb8a6a0445a3119c715f87f349fc86c43e3 (diff)
Added check for if you have permissions to change stream configs
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/commands/CommandManager.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/commands/CommandManager.java b/src/main/java/commands/CommandManager.java
index 1546e01..6b15c81 100644
--- a/src/main/java/commands/CommandManager.java
+++ b/src/main/java/commands/CommandManager.java
@@ -25,12 +25,20 @@ public class CommandManager extends ListenerAdapter {
MessageEmbed scheduleMessage;
switch (command) {
case "remove-config":
+ if (!hasPermission(e)){
+ e.reply("Sorry, you don't have permission to run this command").queue();
+ return;
+ }
String searchTerm = e.getOption("term").getAsString();
long currentDiscChannelID = e.getChannel().getIdLong();
ucm.removeEntry(searchTerm, currentDiscChannelID);
e.reply("Successfully removed " + searchTerm + " from this channel. Please restart the bot for this to take effect").queue();
break;
case "configure":
+ if (!hasPermission(e)){
+ e.reply("Sorry, you don't have permission to run this command").queue();
+ return;
+ }
System.out.println("RUNNING?");
String type = e.getOption("type").getAsString();
String id = e.getOption("id").getAsString();
@@ -104,4 +112,11 @@ public class CommandManager extends ListenerAdapter {
return true;
}
+ public boolean hasPermission(SlashCommandEvent e){
+ if (e.getMember().isOwner()) {
+ return true;
+ }
+ return false;
+ }
+
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage