Fix exception on empty message
This commit is contained in:
parent
eccf4ddf7a
commit
b34a73cea6
4
bot.py
4
bot.py
@ -415,11 +415,11 @@ class Bot:
|
|||||||
return self.treat_prvmsg_ask(msg, srv)
|
return self.treat_prvmsg_ask(msg, srv)
|
||||||
|
|
||||||
# Owner commands
|
# Owner commands
|
||||||
elif msg.content[0] == '`' and msg.nick == srv.owner:
|
elif len(msg.content) > 0 and msg.content[0] == '`' and msg.nick == srv.owner:
|
||||||
#TODO: owner commands
|
#TODO: owner commands
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif msg.content[0] == '!' and len(msg.content) > 1:
|
elif len(msg.content) > 0 and msg.content[0] == '!' and len(msg.content) > 1:
|
||||||
# Remove the !
|
# Remove the !
|
||||||
msg.cmds[0] = msg.cmds[0][1:]
|
msg.cmds[0] = msg.cmds[0][1:]
|
||||||
|
|
||||||
|
@ -154,7 +154,8 @@ def treat_variables(res):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def treat_alias(msg, hooks_cache):
|
def treat_alias(msg, hooks_cache):
|
||||||
if msg.cmd == "PRIVMSG" and (len(msg.cmds[0]) > 0 and msg.cmds[0][0] == "!"
|
if msg.cmd == "PRIVMSG" and len(msg.cmds) > 0 and (len(msg.cmds[0]) > 0
|
||||||
|
and msg.cmds[0][0] == "!"
|
||||||
and msg.cmds[0][1:] in DATAS.getNode("aliases").index
|
and msg.cmds[0][1:] in DATAS.getNode("aliases").index
|
||||||
and msg.cmds[0][1:] not in hooks_cache("cmd_hook")):
|
and msg.cmds[0][1:] not in hooks_cache("cmd_hook")):
|
||||||
msg.content = msg.content.replace(msg.cmds[0],
|
msg.content = msg.content.replace(msg.cmds[0],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user