diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IRCPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IRCPlugin.java index bf6472f..a5e6374 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IRCPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/IRCPlugin.java @@ -23,6 +23,8 @@ public class IRCPlugin extends IRCMessageLoop { private final Map> messageQueue = new HashMap<>(); + private String lastMessage = ""; + public IRCPlugin (Configuration config) { super(config.irc.host, config.irc.port); @@ -133,13 +135,19 @@ public class IRCPlugin extends IRCMessageLoop { final String stringifiedName = ComponentUtilities.stringify(message.displayName); final String stringifiedContents = ComponentUtilities.stringify(message.contents); + final String toSend = String.format( + "<%s> %s", + stringifiedName, + stringifiedContents + ); + + if (lastMessage.equals(toSend)) return; + + lastMessage = toSend; + addMessageToQueue( bot, - String.format( - "<%s> %s", - stringifiedName, - stringifiedContents - ) + toSend ); }