Some bug fixes.

This commit is contained in:
Jonathan Harker 2011-06-03 15:38:53 +12:00
parent b3c4eb0574
commit 67e2dc422c

9
lolbot.py Normal file → Executable file
View file

@ -180,7 +180,8 @@ class LolBot(irc.IRCClient):
print "Joined %s." % (channel,)
def privmsg(self, user, channel, msg):
if channel != self.channel:
user = user.split('!')[0]
if channel == self.nickname:
# Private /msg from a user
self.do_command(msg, user)
else:
@ -203,12 +204,12 @@ class LolBot(irc.IRCClient):
def say_public(self, text):
"Print TEXT into public channel, for all to see."
self.msg(self.channel, text)
self.notice(self.channel, text)
self.log_event(self.nickname, text)
def say_private(self, nick, text):
"Send private message of TEXT to NICK."
self.msg(nick, text)
self.notice(nick, text)
def reply(self, text, to_private=None):
"Send TEXT to either public channel or TO_PRIVATE nick (if defined)."
@ -231,8 +232,6 @@ class LolBot(irc.IRCClient):
private message addressed to the bot. (e.g. "bot: blah").
"""
target = target.strip()
try:
if cmd == 'help':
self.reply(self.helptext, target)