Added configurable command prefix
This commit is contained in:
parent
664b67c5c0
commit
6f37dfa9bc
3
config
3
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"]
|
||||
}
|
||||
|
|
|
@ -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+)(.*)'
|
||||
|
|
Reference in New Issue