Moved debug channels to #bot-room

This commit is contained in:
alisolarflare 2016-11-23 11:04:00 -05:00
parent f7c6614c2a
commit 25e189e4d1
2 changed files with 30 additions and 29 deletions

View file

@ -1,28 +1,29 @@
package buttondevteam.discordplugin; package buttondevteam.discordplugin.listeners;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import buttondevteam.lib.TBMCDebugMessageEvent; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCDebugMessageEvent;
public class DebugMessageListener implements Listener{
@EventHandler public class DebugMessageListener implements Listener{
public void onException(TBMCDebugMessageEvent e) { @EventHandler
SendMessage(e.getDebugMessage()); public void onException(TBMCDebugMessageEvent e) {
e.setSent(); SendMessage(e.getDebugMessage());
} e.setSent();
}
private static void SendMessage(String message) {
try { private static void SendMessage(String message) {
StringBuilder sb = new StringBuilder(); try {
sb.append("```").append("\n"); StringBuilder sb = new StringBuilder();
if (message.length() > 2000) sb.append("```").append("\n");
message = message.substring(0, 2000); if (message.length() > 2000)
sb.append(message).append("\n"); message = message.substring(0, 2000);
sb.append("```"); sb.append(message).append("\n");
DiscordPlugin.sendMessageToChannel(DiscordPlugin.debugchannel, sb.toString()); sb.append("```");
} catch (Exception ex) { DiscordPlugin.sendMessageToChannel(DiscordPlugin.botchannel, sb.toString());
ex.printStackTrace(); } catch (Exception ex) {
} ex.printStackTrace();
} }
}
}
}

View file

@ -24,7 +24,7 @@ public class ExceptionListener implements Listener {
stackTrace = stackTrace.substring(0, 2000); stackTrace = stackTrace.substring(0, 2000);
sb.append(stackTrace).append("\n"); sb.append(stackTrace).append("\n");
sb.append("```"); sb.append("```");
DiscordPlugin.sendMessageToChannel(DiscordPlugin.issuechannel, sb.toString()); DiscordPlugin.sendMessageToChannel(DiscordPlugin.botchannel, sb.toString());
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }