]> jfr.im git - erebus.git/blobdiff - bot.py
* - change old code to use newer cfg.getboolean instead of bool(int())
[erebus.git] / bot.py
diff --git a/bot.py b/bot.py
index bab5d4cdb27e21420bfc75759bc17b4f4509781e..d5d397153821e7d3d8f4ce4c84cf476b3ec300a6 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -51,9 +51,9 @@ class Bot(object):
                except: pass
 
        def watchdog(self):
-               if time.time() > self.parent.cfg.get('watchdog', 'maxtime', default=300)+self.lastreceived:
+               if time.time() > int(self.parent.cfg.get('watchdog', 'maxtime', default=300))+self.lastreceived:
                        self.parse("ERROR :Fake-error from watchdog timer.")
-               self.watchdogtimer = MyTimer(self.parent.cfg.get('watchdog', 'interval', default=30), self.watchdog)
+               self.watchdogtimer = MyTimer(int(self.parent.cfg.get('watchdog', 'interval', default=30)), self.watchdog)
 
        def log(self, *args, **kwargs):
                self.parent.log(self.nick, *args, **kwargs)
@@ -71,7 +71,8 @@ class Bot(object):
                        self.conn.send("NICK %s" % (self.permnick))
 
        def parse(self, line):
-               self.log('I', line)
+               if self.parent.cfg.getboolean('debug', 'io'):
+                       self.log('I', line)
                pieces = line.split()
 
                # dispatch dict
@@ -250,7 +251,7 @@ class Bot(object):
                                pass # don't care about other modes
 
        def __debug_cbexception(self, source, *args, **kwargs):
-               if int(self.parent.cfg.get('debug', 'cbexc', default=0)) == 1:
+               if self.parent.cfg.getboolean('debug', 'cbexc'):
                        self.conn.send("PRIVMSG %s :%09.3f \ 34\1f!!! CBEXC\1f\ 3 %s" % (self.parent.cfg.get('debug', 'owner'), time.time() % 100000, source))
                        __import__('traceback').print_exc()
                        self.log('!', "CBEXC %s %r %r" % (source, args, kwargs))
@@ -336,7 +337,7 @@ class Bot(object):
                        self.msg(user, "You don't have enough access to run that command.")
 
        def __debug_nomsg(self, target, msg):
-               if int(self.parent.cfg.get('debug', 'nomsg', default=0)) == 1:
+               if self.parent.cfg.getboolean('debug', 'nomsg'):
                        self.conn.send("PRIVMSG %s :%09.3f \ 34\1f!!! NOMSG\1f\ 3 %r, %r" % (self.parent.cfg.get('debug', 'owner'), time.time() % 100000, target, msg))
                        self.log('!', "!!! NOMSG")
 #                      print "%09.3f %s [!] %s" % (time.time() % 100000, self.nick, "!!! NOMSG")
@@ -453,7 +454,8 @@ class BotConnection(object):
                return self.state == 2
 
        def send(self, line):
-               self.parent.log('O', line)
+               if self.parent.cfg.getboolean('debug', 'io'):
+                       self.parent.log('O', line)
 #              print "%09.3f %s [O] %s" % (time.time() % 100000, self.parent.nick, line)
                self.bytessent += len(line)
                self._write(line)