From 419a52621dc43672dd992a273dc4c996396d417e Mon Sep 17 00:00:00 2001 From: cnaude Date: Sat, 17 Dec 2016 22:26:41 -0700 Subject: [PATCH] Add some additional debugging to figure out issue #26. Update pom for DiscordSRV 12.3. --- pom.xml | 2 +- .../java/com/cnaude/purpleirc/Hooks/DiscordSRVHook.java | 8 ++++++-- src/main/java/com/cnaude/purpleirc/PurpleBot.java | 4 ++-- src/main/java/com/cnaude/purpleirc/TemplateName.java | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index ff22d55..ca6069e 100644 --- a/pom.xml +++ b/pom.xml @@ -420,7 +420,7 @@ com.scarsz.discordsrv DiscordSRV - 11.0 + 12.3 provided diff --git a/src/main/java/com/cnaude/purpleirc/Hooks/DiscordSRVHook.java b/src/main/java/com/cnaude/purpleirc/Hooks/DiscordSRVHook.java index b359801..17f2c8b 100644 --- a/src/main/java/com/cnaude/purpleirc/Hooks/DiscordSRVHook.java +++ b/src/main/java/com/cnaude/purpleirc/Hooks/DiscordSRVHook.java @@ -48,11 +48,15 @@ public class DiscordSRVHook { public void sendMessage(String channelName, String message) { TextChannel textChannel = DiscordSRV.getTextChannelFromChannelName(channelName); + TextChannel chatChannel = DiscordSRV.chatChannel; + plugin.logDebug("DiscordSRVHook: Message to be sent: " + message); if (textChannel != null) { - plugin.logDebug("DiscordSRVHook[" + channelName + "]: " + message); + plugin.logDebug("DiscordSRVHook: Sending mssage to channel " + channelName); textChannel.sendMessage(message); } else { - plugin.logDebug("DiscordSRVHook: " + message); + plugin.logDebug("DiscordSRVHook: Unable to find channel: " + channelName); + plugin.logDebug("DiscordSRVHook: Channel list: " + DiscordSRV.channels.keySet()); + plugin.logDebug("DiscordSRVHook: Sending message to ChatChannel instead: " + chatChannel.getName()); DiscordSRV.sendMessageToChatChannel(message); } diff --git a/src/main/java/com/cnaude/purpleirc/PurpleBot.java b/src/main/java/com/cnaude/purpleirc/PurpleBot.java index c19bbb6..14cbc48 100644 --- a/src/main/java/com/cnaude/purpleirc/PurpleBot.java +++ b/src/main/java/com/cnaude/purpleirc/PurpleBot.java @@ -1561,10 +1561,10 @@ public final class PurpleBot { return; } for (String channelName : botChannels) { - if (isMessageEnabled(channelName, TemplateName.GAME_DISCORD_CHAT)) { + if (isMessageEnabled(channelName, TemplateName.DISCORD_CHAT)) { asyncIRCMessage(channelName, plugin.tokenizer .gameChatToIRCTokenizer(username, plugin.getMessageTemplate( - botNick, channelName, TemplateName.GAME_DISCORD_CHAT), message) + botNick, channelName, TemplateName.DISCORD_CHAT), message) .replace("%CHANNEL%", channelId) ); } diff --git a/src/main/java/com/cnaude/purpleirc/TemplateName.java b/src/main/java/com/cnaude/purpleirc/TemplateName.java index ff5f902..9ccc4ba 100644 --- a/src/main/java/com/cnaude/purpleirc/TemplateName.java +++ b/src/main/java/com/cnaude/purpleirc/TemplateName.java @@ -149,7 +149,7 @@ public class TemplateName { public final static String GAME_ADMIN_CHAT = "game-a-chat"; public final static String IRC_ADMIN_CHAT = "irc-a-chat"; - public final static String GAME_DISCORD_CHAT = "discord-chat"; + public final static String DISCORD_CHAT = "discord-chat"; public final static String IRC_DISCORD_CHAT = "irc-discord-chat"; public final static String FAKE_JOIN = "fake-join";