Closed MTRNord closed 8 years ago
The current implementation handles 1 server per client created. If you create another client in your code, then you'll have two bots connected to two servers.
@del6597 yeah that did I see but how can I make that both clients can use the same function? Is this in any way possible?
@MTRNord You could just make your own addListener
function that iterates your list of clients and adds the listener function to each of your clients.
Something like this maybe:
var client1 = Client(...);
var client2 = Client(...);
var clients = [client1, client2];
function addListener(event, callback) {
clients.forEach(function(client) {
client.addListener(event, callback);
});
}
@jirwin i will try that :) thanks for the idea
@jirwin seems to work but hackint.org is sadly kicking the bot sometimes with "quit: Excess Flood" :/
@MTRNord try enabling the floodControl option in the config.
@jirwin that seems to help :) hopefully i can speed up the forEach. it slows the bot extremly down
@MTRNord do you have a code snippet you can share? I wouldn't expect things to slow dow much(other than flood control doing its thing)
@jirwin https://github.com/MTRNord/nordlab-hackerspace-door/blob/v0.0.2/handlers/irc.js this is my code for the bot. I know that there are also other things that are slowing the bot down.
Closing this.
Hi I want to have the client connected to multiple servers without writing the hole handling stuff all over again. Are there any ways to do so?