Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add verbose flag.

Passing verbose=False will silence bot output to STDOUT.
  • Loading branch information...
commit 2420b0640dd9db3b25b76dbcbd25432bcac8f997 1 parent c4cefce
@sarenji authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 pyrc/bots.py
View
5 pyrc/bots.py
@@ -25,6 +25,7 @@ def __init__(self, host, **kwargs):
self.config.setdefault('channels', [])
self.config.setdefault('password', password)
self.config.setdefault('break_on_match', True)
+ self.config.setdefault('verbose', True)
self._inbuffer = ""
self._commands = []
@@ -71,7 +72,7 @@ def listen(self):
for line in temp:
# Strip \r from \r\n for RFC-compliant IRC servers.
line = line.rstrip('\r')
- print line
+ if self.config['verbose']: print line
self.run_listeners(line)
def run_listeners(self, line):
@@ -142,7 +143,7 @@ def join(self, *channels):
self.cmd('JOIN %s' % (' '.join(channels)))
def cmd(self, raw_line):
- print "> %s" % raw_line
+ if self.config['verbose']: print "> %s" % raw_line
self.socket.send(raw_line + "\r\n")
def _connect(self):
Please sign in to comment.
Something went wrong with that request. Please try again.