]> jfr.im git - erebus.git/commitdiff
core - add debug check for printing input/output
authorzonidjan <redacted>
Fri, 10 Nov 2017 23:42:07 +0000 (17:42 -0600)
committerzonidjan <redacted>
Fri, 10 Nov 2017 23:42:07 +0000 (17:42 -0600)
bot.py

diff --git a/bot.py b/bot.py
index bab5d4cdb27e21420bfc75759bc17b4f4509781e..883472448f039b1c17d381ba6749657c670445a3 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -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)