diff --git a/irc.py b/irc.py index 38fe886..e5bfdc3 100755 --- a/irc.py +++ b/irc.py @@ -43,9 +43,12 @@ class Bot(asynchat.async_chat): def __write(self, args, text=None): # print '%r %r %r' % (self, args, text) - if text is not None: - self.push(' '.join(args) + ' :' + text + '\r\n') - else: self.push(' '.join(args) + '\r\n') + try: + if text is not None: + self.push(' '.join(args) + ' :' + text + '\r\n') + else: self.push(' '.join(args) + '\r\n') + except IndexError: + pass def write(self, args, text=None): # This is a safe version of __write diff --git a/modules/dict.py b/modules/dict.py index 61fcee9..df9025d 100755 --- a/modules/dict.py +++ b/modules/dict.py @@ -109,7 +109,7 @@ def dict(phenny, input): result = input.group(2).encode('utf-8') + ' - ' for key in sorted(results.keys()): if results[key]: - result += key + ' 1. ' + results[key][0] + result += (key or '') + ' 1. ' + results[key][0] if len(results[key]) > 1: result += ', 2. ' + results[key][1] result += '; ' diff --git a/modules/translate.py b/modules/translate.py index 23ce7e9..27bd094 100755 --- a/modules/translate.py +++ b/modules/translate.py @@ -11,7 +11,7 @@ http://inamidst.com/phenny/ import re, time import web -r_translation = re.compile(r'