temporarily fix

this can be bypassed with something like random strings
i am not sure how to make it auto reconnect yet but should be simple
This commit is contained in:
Chayapak 2023-10-19 16:00:35 +07:00
parent 031c592b33
commit c0a1681b27

View file

@ -23,6 +23,8 @@ public class IRCPlugin extends IRCMessageLoop {
private final Map<String, List<String>> messageQueue = new HashMap<>(); private final Map<String, List<String>> messageQueue = new HashMap<>();
private String lastMessage = "";
public IRCPlugin (Configuration config) { public IRCPlugin (Configuration config) {
super(config.irc.host, config.irc.port); 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 stringifiedName = ComponentUtilities.stringify(message.displayName);
final String stringifiedContents = ComponentUtilities.stringify(message.contents); final String stringifiedContents = ComponentUtilities.stringify(message.contents);
final String toSend = String.format(
"<%s> %s",
stringifiedName,
stringifiedContents
);
if (lastMessage.equals(toSend)) return;
lastMessage = toSend;
addMessageToQueue( addMessageToQueue(
bot, bot,
String.format( toSend
"<%s> %s",
stringifiedName,
stringifiedContents
)
); );
} }