From 2b44d0af29588456f3c74d2571b0850d0760abce Mon Sep 17 00:00:00 2001 From: craisins Date: Thu, 8 May 2014 23:09:58 -0400 Subject: [PATCH] Added support for custom bot prefixes --- core/config.py | 1 + core/main.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/config.py b/core/config.py index ac8ebca..f92b16a 100644 --- a/core/config.py +++ b/core/config.py @@ -19,6 +19,7 @@ if not os.path.exists('config'): "channels": ["#test"] } }, + "prefix": ".", "disabled_plugins": [], "disabled_commands": [], "acls": {}, diff --git a/core/main.py b/core/main.py index b8fa3d2..38ebfa8 100644 --- a/core/main.py +++ b/core/main.py @@ -163,10 +163,11 @@ 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'^(?:[.]?|' + prefix = r'^(?:['+bot_prefix+']?|' else: - prefix = r'^(?:[.]|' + prefix = r'^(?:['+bot_prefix+']|' command_re = prefix + inp.conn.nick command_re += r'[:,]+\s+)(\w+)(?:$|\s+)(.*)'