Merge pull request #123 from socram8888/master

Properly handle multicharacter bot prefixes
This commit is contained in:
Ryan Hitchman 2014-11-26 16:20:04 -06:00
commit 5e21e1b7b5
1 changed files with 3 additions and 3 deletions

View File

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