diff --git a/pom.xml b/pom.xml
index 7f24558..d92b279 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.github.andrewlalis
HandieBot
- 1.3.0
+ 1.3.1
diff --git a/src/main/java/handiebot/command/Commands.java b/src/main/java/handiebot/command/Commands.java
index 9a00c50..a50ea8a 100644
--- a/src/main/java/handiebot/command/Commands.java
+++ b/src/main/java/handiebot/command/Commands.java
@@ -50,22 +50,24 @@ public class Commands {
for (Command cmd : commands) {
if (cmd.getName().equals(command)){
if (cmd instanceof StaticCommand){
+ log.log(BotLog.TYPE.COMMAND, command+" has been issued.");
((StaticCommand)cmd).execute();
return;
} else if (!cmd.canUserExecute(context.getUser(), context.getGuild())){
- log.log(BotLog.TYPE.ERROR, context.getGuild(), MessageFormat.format(resourceBundle.getString("commands.noPermission.log"), context.getUser().getName(), cmd.getName()));
+ log.log(BotLog.TYPE.COMMAND, context.getGuild(), MessageFormat.format(resourceBundle.getString("commands.noPermission.log"), context.getUser().getName(), cmd.getName()));
context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("commands.noPermission.message"), command));
return;
} else if (cmd instanceof ContextCommand){
+ log.log(BotLog.TYPE.COMMAND, context.getGuild(), context.getUser().getName()+" has issued the command: "+command);
((ContextCommand)cmd).execute(context);
return;
}
}
}
if (context == null){
- log.log(BotLog.TYPE.ERROR, MessageFormat.format(resourceBundle.getString("commands.invalidCommand.noContext"), command));
+ log.log(BotLog.TYPE.COMMAND, MessageFormat.format(resourceBundle.getString("commands.invalidCommand.noContext"), command));
} else {
- log.log(BotLog.TYPE.ERROR, context.getGuild(), MessageFormat.format(resourceBundle.getString("commands.invalidCommand.context"), command, context.getUser().getName()));
+ log.log(BotLog.TYPE.COMMAND, context.getGuild(), MessageFormat.format(resourceBundle.getString("commands.invalidCommand.context"), command, context.getUser().getName()));
}
}
diff --git a/src/main/java/handiebot/command/ReactionHandler.java b/src/main/java/handiebot/command/ReactionHandler.java
index 1c3b9bc..204882a 100644
--- a/src/main/java/handiebot/command/ReactionHandler.java
+++ b/src/main/java/handiebot/command/ReactionHandler.java
@@ -1,6 +1,7 @@
package handiebot.command;
import handiebot.HandieBot;
+import handiebot.view.BotLog;
import sx.blah.discord.handle.impl.events.guild.channel.message.reaction.ReactionEvent;
import sx.blah.discord.handle.obj.IMessage;
import sx.blah.discord.handle.obj.IReaction;
@@ -8,12 +9,14 @@ import sx.blah.discord.handle.obj.IUser;
import java.util.List;
+import static handiebot.HandieBot.log;
+
/**
* @author Andrew Lalis
* Class which handles user reactions to songs and performs necessary actions.
*/
public class ReactionHandler {
-
+//TODO: Fix so only reactions on the most recent song count!
public static final String thumbsUp = "\uD83D\uDC4D";
public static final String thumbsDown = "\uD83D\uDC4E";
@@ -38,7 +41,12 @@ public class ReactionHandler {
* @param message The messages that received a reaction.
*/
private static void onDownvote(CommandContext context, IMessage message){
+ //Filter out reactions to previous messages.
+ if (!message.getContent().contains(HandieBot.musicPlayer.getMusicManager(context.getGuild()).scheduler.getPlayingTrack().getTitle())){
+ return;
+ }
List usersHere = HandieBot.musicPlayer.getVoiceChannel(context.getGuild()).getConnectedUsers();
+ //Remove the bot from the list of users in the voice channel.
usersHere.removeIf(user -> user.getLongID() == HandieBot.client.getOurUser().getLongID());
int userCount = usersHere.size();
int userDownvotes = 0;
@@ -48,8 +56,8 @@ public class ReactionHandler {
userDownvotes++;
}
}
- System.out.println("Valid downvotes: "+userDownvotes+" out of "+userCount+" people present.");
if (userDownvotes > (userCount/2)){
+ log.log(BotLog.TYPE.MUSIC, context.getGuild(), "Users voted to skip the current song.");
HandieBot.musicPlayer.skipTrack(context.getGuild());
} else if (userDownvotes > 0) {
context.getChannel().sendMessage((((userCount/2)+1) - userDownvotes)+" more people must downvote before the track is skipped.");
diff --git a/src/main/java/handiebot/command/commands/music/PlaylistCommand.java b/src/main/java/handiebot/command/commands/music/PlaylistCommand.java
index d61fa02..99ca25e 100644
--- a/src/main/java/handiebot/command/commands/music/PlaylistCommand.java
+++ b/src/main/java/handiebot/command/commands/music/PlaylistCommand.java
@@ -9,6 +9,7 @@ import handiebot.lavaplayer.playlist.UnloadedTrack;
import handiebot.utils.DisappearingMessage;
import handiebot.view.BotLog;
import sx.blah.discord.handle.obj.IChannel;
+import sx.blah.discord.util.RequestBuffer;
import java.io.File;
import java.text.MessageFormat;
@@ -159,7 +160,7 @@ public class PlaylistCommand extends ContextCommand {
playlist.load();
for (int i = 2; i < context.getArgs().length; i++){
playlist.loadTrack(context.getArgs()[i]);
- context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("commands.command.playlist.add.message"), playlist.getName()));
+ RequestBuffer.request(() -> context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("commands.command.playlist.add.message"), playlist.getName()))).get();
}
playlist.save();
context.getChannel().sendMessage(playlist.toString());
diff --git a/src/main/java/handiebot/lavaplayer/playlist/Playlist.java b/src/main/java/handiebot/lavaplayer/playlist/Playlist.java
index a9be6b3..47ae886 100644
--- a/src/main/java/handiebot/lavaplayer/playlist/Playlist.java
+++ b/src/main/java/handiebot/lavaplayer/playlist/Playlist.java
@@ -159,7 +159,7 @@ public class Playlist {
*/
public void load(){
String path = System.getProperty("user.home")+"/.handiebot/playlist/"+name.replace(" ", "_")+".txt";
- log.log(BotLog.TYPE.INFO, "Loading playlist from: "+path);
+ log.log(BotLog.TYPE.MUSIC, "Loading playlist from: "+path);
File playlistFile = new File(path);
if (playlistFile.exists()){
try {