]> jfr.im git - erebus.git/blobdiff - bot.py
Added 'Title:' to general title checker
[erebus.git] / bot.py
diff --git a/bot.py b/bot.py
index ec471e3dbd549d39c880e8925c9de165ddd79bd9..10be7f6a4908207091535cc1d05f4021c53eddd5 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -89,7 +89,8 @@ class Bot(object):
                                chanword = pieces[1]
                                if chanword[0] == '#':
                                        chan = self.parent.channel(chanword)
-                                       pieces.pop(1)
+                                       if chan is not None: #if chan is still none, there's no bot on "chanword", and chanword is used as a parameter.
+                                               pieces.pop(1)
 
                else: # message was sent to a channel
                        chan = self.parent.channel(target) #TODO check if bot's on channel --- in Erebus.channel() maybe?
@@ -113,10 +114,10 @@ class Bot(object):
                                        cbret = callback(self, user, chan, target, *pieces[1:])
                                        if cbret is NotImplemented:
                                                self.msg(user, "Command not implemented.")
-               else:
-                       self.msg(user, "No such command.")
 
        def msg(self, target, msg):
+               if target is None or msg is None: return
+
                if isinstance(target, self.parent.User): self.conn.send("NOTICE %s :%s" % (target.nick, msg))
                elif isinstance(target, self.parent.Channel): self.conn.send("PRIVMSG %s :%s" % (target.name, msg))
                elif isinstance(target, basestring):