fixed crash when user doesn't have "account" tag

This commit is contained in:
jan6 2021-10-03 16:22:50 +03:00
parent 9f3c36ec0b
commit 405b756d88
1 changed files with 11 additions and 5 deletions

View File

@ -91,19 +91,20 @@ def stuff(bot,sock):
cmd=cmd.replace(self_nick, '', 1)
command.prefix=self_nick
except IndexError:
cmd="none of yer biznez"
continue #skip to next command
cmd="echo IndexError or something"
cmd=cmd.strip()
is_adm=line.source in admin_users or line.tags["account"] in admin_accounts
try:is_adm=line.tags["account"] in admin_accounts or line.source in admin_users
except KeyError:is_adm=line.source in admin_users
command.line=line
command.pm=is_pm
command.cmd=cmd
command.admin=is_adm
command.config=config
if cmd.startswith("echo "):
command.exec_cmd("echo")
#handle special commands (requiring extra args 'n stuff)
if cmd=="help":
command.exec_cmd("help",[prefixes,enabled_commands,admin_commands])
if cmd.startswith("help "):
elif cmd.startswith("help "):
topic=cmd.split(" ",1)[1]
command.exec_cmd("help",[prefixes,enabled_commands,admin_commands,topic,self_nick])
elif is_adm and (cmd=="q" or cmd=="quit"):
@ -127,3 +128,8 @@ def stuff(bot,sock):
except Exception as e:
mesg("Error: "+str(e))
else: mesg("Error: you're not authorized to exec")
#handle normal commands
if cmd.startswith("echo "):
command.exec_cmd("echo")