Properly handle multicharacter bot prefixes

This commit is contained in:
Marcos Vives Del Sol 2014-11-23 16:19:56 +01:00
parent fa904d2ded
commit 4c970f6b16
1 changed files with 3 additions and 3 deletions

View File

@ -175,10 +175,10 @@ def main(conn, out):
if inp.command == 'PRIVMSG':
# COMMANDS
bot_prefix = re.escape(bot.config.get("prefix", "."))
if inp.chan == inp.nick: # private message, no command prefix
prefix = r'^(?:['+bot_prefix+']?|'
if inp.chan == inp.nick: # private message, no command prefix required
prefix = r'^(?:(?:'+bot_prefix+')?|'
else:
prefix = r'^(?:['+bot_prefix+']|'
prefix = r'^(?:'+bot_prefix+'|'
command_re = prefix + inp.conn.nick
command_re += r'[:,]+\s+)(\w+)(?:$|\s+)(.*)'