fix a crashing bug when doing !help ping

This commit is contained in:
Jimmy Cao 2012-04-02 16:14:13 -05:00
parent a294fd3fca
commit 5aef3b4c5b
2 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import botconfig
from tools import decorators from tools import decorators
import logging import logging
import tools.moduleloader as ld import tools.moduleloader as ld
import traceback
def on_privmsg(cli, rawnick, chan, msg): def on_privmsg(cli, rawnick, chan, msg):

View File

@ -1883,7 +1883,7 @@ def mass_privmsg(cli, targets, msg):
def relay(cli, nick, rest): def relay(cli, nick, rest):
"""Let the wolves talk to each other through the bot""" """Let the wolves talk to each other through the bot"""
if var.PHASE not in ("night", "day"): if var.PHASE not in ("night", "day"):
return return
badguys = var.ROLES["wolf"] + var.ROLES["traitor"] + var.ROLES["werecrow"] badguys = var.ROLES["wolf"] + var.ROLES["traitor"] + var.ROLES["werecrow"]
if len(badguys) > 1: if len(badguys) > 1:
@ -2348,12 +2348,14 @@ def get_help(cli, rnick, rest):
found = True found = True
for fn in c[cname]: for fn in c[cname]:
if fn.__doc__: if fn.__doc__:
if nick == botconfig.CHANNEL:
var.LOGGER.logMessage(botconfig.CMD_CHAR+cname+": "+fn.__doc__(rest))
if callable(fn.__doc__): if callable(fn.__doc__):
cli.msg(nick, botconfig.CMD_CHAR+cname+": "+fn.__doc__(rest)) cli.msg(nick, botconfig.CMD_CHAR+cname+": "+fn.__doc__(rest))
if nick == botconfig.CHANNEL:
var.LOGGER.logMessage(botconfig.CMD_CHAR+cname+": "+fn.__doc__(rest))
else: else:
cli.msg(nick, botconfig.CMD_CHAR+cname+": "+fn.__doc__) cli.msg(nick, botconfig.CMD_CHAR+cname+": "+fn.__doc__)
if nick == botconfig.CHANNEL:
var.LOGGER.logMessage(botconfig.CMD_CHAR+cname+": "+fn.__doc__)
return return
else: else:
continue continue