diff --git a/pom.xml b/pom.xml index 7fd2955..d55581b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.andrewlalis HandieBot - 1.4.0 + 1.4.1 diff --git a/src/main/java/handiebot/command/Commands.java b/src/main/java/handiebot/command/Commands.java index 8fb960a..c3bb520 100644 --- a/src/main/java/handiebot/command/Commands.java +++ b/src/main/java/handiebot/command/Commands.java @@ -52,7 +52,8 @@ public class Commands { public static void executeCommand(String command, CommandContext context){ for (Command cmd : commands) { if (cmd.getName().equals(command)){ - if (cmd instanceof StaticCommand){ + if (cmd instanceof StaticCommand && + ((context != null && cmd.canUserExecute(context.getUser(), context.getGuild())) || context == null)){ log.log(BotLog.TYPE.COMMAND, command+" has been issued."); ((StaticCommand)cmd).execute(); return; diff --git a/src/main/java/handiebot/command/commands/music/PlayCommand.java b/src/main/java/handiebot/command/commands/music/PlayCommand.java index 6a5aa5b..65fd245 100644 --- a/src/main/java/handiebot/command/commands/music/PlayCommand.java +++ b/src/main/java/handiebot/command/commands/music/PlayCommand.java @@ -4,13 +4,11 @@ import com.google.api.services.youtube.model.Video; import handiebot.HandieBot; import handiebot.command.CommandContext; import handiebot.command.ReactionHandler; -import handiebot.command.reactionListeners.YoutubeChoiceListener; +import handiebot.command.reactionListeners.YoutubePlayListener; import handiebot.command.types.ContextCommand; import handiebot.lavaplayer.playlist.UnloadedTrack; import handiebot.utils.YoutubeSearch; -import sx.blah.discord.api.internal.json.objects.EmbedObject; import sx.blah.discord.handle.obj.IMessage; -import sx.blah.discord.util.RequestBuffer; import java.text.MessageFormat; import java.util.ArrayList; @@ -46,24 +44,17 @@ public class PlayCommand extends ContextCommand { e.printStackTrace(); } } else { - //Construct a Youtube song. + //Construct a Youtube song choice. StringBuilder sb = new StringBuilder(); for (int i = 0; i < context.getArgs().length; i++){ sb.append(context.getArgs()[i]).append(' '); } List