I'm currently making a IRC bot in Java (I know, there are frameworks out there) and I'm trying to have it connect to multiple servers. The problem I'm having with this is not the connecting part, I'm just running my Connect class in x amount of threads. Each thread will connect the bot to the server/port specified. Now my problem is that when certain text is outputted by a user the bot is supposed to message the channel saying "you typed this command" (for an example). Now I would want the bot to message ALL servers saying "you typed this command". This is simply just an example (which is why it doesnt make much sense).
Connect f = new Connect(irc.freenode.net, 6667);
Thread ft = new Thread(f);
ft.start();
Connect q = new Connect(irc.quakenet.org, 6667);
Thread qt = new Thread(q);
qt.start();
Now having the example code above, I would want one thread to talk to the other when certain text is typed. Something like:
if (lineReader.substring(lineReader.indexOf(":"), lineReader.length()).equals("hello")) {
message both servers "Hello World!"
}
If anyone could help, I'd greatly appreciate it. Thanks!