Added typing and test

This commit is contained in:
Norbi Peti 2016-11-14 18:06:54 +01:00
parent f665d1c8b9
commit ce9e2987b3

View file

@ -1,5 +1,7 @@
package buttondevteam.discordplugin; package buttondevteam.discordplugin;
import org.bukkit.Bukkit;
import buttondevteam.discordplugin.commands.DiscordCommandBase; import buttondevteam.discordplugin.commands.DiscordCommandBase;
import sx.blah.discord.api.events.IListener; import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.MentionEvent; import sx.blah.discord.handle.impl.events.MentionEvent;
@ -23,6 +25,8 @@ public class CommandListener {
}, new IListener<MessageReceivedEvent>() { }, new IListener<MessageReceivedEvent>() {
@Override @Override
public void handle(MessageReceivedEvent event) { public void handle(MessageReceivedEvent event) {
if (event.getMessage().getChannel().getID().equals("219626707458457603"))
Bukkit.getLogger().info("Message in dev: " + event.getMessage().getContent());
if (!event.getMessage().getChannel().isPrivate()) if (!event.getMessage().getChannel().isPrivate())
return; return;
if (event.getMessage().getAuthor().isBot()) if (event.getMessage().getAuthor().isBot())
@ -33,6 +37,7 @@ public class CommandListener {
} }
private static void runCommand(IMessage message) { private static void runCommand(IMessage message) {
message.getChannel().setTypingStatus(true);
String cmdwithargs = message.getContent(); String cmdwithargs = message.getContent();
final String mention = DiscordPlugin.dc.getOurUser().mention(false); final String mention = DiscordPlugin.dc.getOurUser().mention(false);
final String mentionNick = DiscordPlugin.dc.getOurUser().mention(true); final String mentionNick = DiscordPlugin.dc.getOurUser().mention(true);
@ -57,5 +62,6 @@ public class CommandListener {
args = cmdwithargs.substring(index + 1); args = cmdwithargs.substring(index + 1);
} }
DiscordCommandBase.runCommand(cmd, args, message); DiscordCommandBase.runCommand(cmd, args, message);
message.getChannel().setTypingStatus(false);
} }
} }