]> jfr.im git - erebus.git/blobdiff - bot.py
Fixed bot.send() to work with unicode.
[erebus.git] / bot.py
diff --git a/bot.py b/bot.py
index 94a12abfe67d63d33b814d6cf09ccc13dd78106b..2a4dd14e14c2cc5d0225d0d4e551baf0fbb55315 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding: latin-1 -*-
 
 # Erebus IRC bot - Author: John Runyon
 # "Bot" and "BotConnection" classes (handling a specific "arm")
@@ -88,10 +89,10 @@ class Bot(object):
                        
        def parsemsg(self, user, target, msg):
                chan = None
-               try:
-                       triggerused = msg[0] == self.parent.trigger
-               except IndexError: # Fix if you feel like it /BiohZn
-                       triggerused = False
+               if len(msg) == 0:
+                       return
+
+               triggerused = msg[0] == self.parent.trigger
                if triggerused: msg = msg[1:]
                pieces = msg.split()
 
@@ -180,7 +181,7 @@ class BotConnection(object):
 
        #TODO: rewrite send() to queue
        def send(self, line):
-               print self.parent.nick, '[O]', line
+               print self.parent.nick, '[O]', str(line)
                self.write(line)
 
        def write(self, line):