From 863bebb14e02a447f037fc7702276d5ed92dc323 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 27 Apr 2016 11:56:37 +0100 Subject: [PATCH] added code to allow you to keep a server in the database but not connect to it. --- IRCBot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/IRCBot.py b/IRCBot.py index 3509effa..9e2f223e 100644 --- a/IRCBot.py +++ b/IRCBot.py @@ -20,9 +20,11 @@ class Bot(object): nickname, username, realname, connect=False): new_server = IRCServer.Server(id, hostname, port, password, ipv4, tls, nickname, username, realname, self) + if not new_server.get_setting("connect", True): + return self.events.on("new").on("server").call(server=new_server) self.servers[new_server.fileno()] = new_server - if connect: + if connect and new_server.get_setting("connect", True): self.connect(new_server) def connect(self, server): try: @@ -35,7 +37,8 @@ class Bot(object): return True def connect_all(self): for server in self.servers.values(): - self.connect(server) + if server.get_setting("connect", True): + self.connect(server) def setup_timers(self, event): for setting, value in self.find_settings("timer-%"):