Added configurable command prefix

This commit is contained in:
Luke Rogers 2011-11-21 00:03:49 +13:00
parent 664b67c5c0
commit 6f37dfa9bc
2 changed files with 5 additions and 3 deletions

3
config
View File

@ -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"]
}

View File

@ -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+)(.*)'