From 6f37dfa9bc6f414b1cc46a16f974cf2e20bfa81c Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 21 Nov 2011 00:03:49 +1300 Subject: [PATCH] Added configurable command prefix --- config | 3 ++- core/main.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config b/config index 83314c7..94d8355 100644 --- a/config +++ b/config @@ -14,6 +14,7 @@ "disabled_plugins": [], "disabled_commands": [], "acls": {}, + "prefix": ".", "api_keys": {"geoip":"NULL","mc":["USER","PASS"]}, "censored_strings": [ @@ -27,5 +28,5 @@ "!coz", "!tell /x" ], - "admins": ["TheLuke","Luke"] + "admins": ["USERNAME"] } diff --git a/core/main.py b/core/main.py index a4b4f2a..26e13c7 100644 --- a/core/main.py +++ b/core/main.py @@ -143,6 +143,7 @@ def match_command(command): def main(conn, out): inp = Input(conn, *out) + commandprefix = bot.config['prefix'] # EVENTS for func, args in bot.events[inp.command] + bot.events['*']: @@ -151,9 +152,9 @@ def main(conn, out): if inp.command == 'PRIVMSG': # COMMANDS if inp.chan == inp.nick: # private message, no command prefix - prefix = r'^(?:[.]?|' + prefix = r'^(?:[' + commandprefix + ']?|' else: - prefix = r'^(?:[.]|' + prefix = r'^(?:[' + commandprefix + ']|' command_re = prefix + inp.conn.nick command_re += r'[:]+\s+)(\w+)(?:$|\s+)(.*)'