Added support for custom bot prefixes
This commit is contained in:
parent
ab2a36260e
commit
2b44d0af29
|
@ -19,6 +19,7 @@ if not os.path.exists('config'):
|
|||
"channels": ["#test"]
|
||||
}
|
||||
},
|
||||
"prefix": ".",
|
||||
"disabled_plugins": [],
|
||||
"disabled_commands": [],
|
||||
"acls": {},
|
||||
|
|
|
@ -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+)(.*)'
|
||||
|
|
Loading…
Reference in New Issue