Skip to content

Commit

Permalink
Added support for custom bot prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
craisins committed May 9, 2014
1 parent ab2a362 commit 2b44d0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def save(conf):
"channels": ["#test"]
}
},
"prefix": ".",
"disabled_plugins": [],
"disabled_commands": [],
"acls": {},
Expand Down
5 changes: 3 additions & 2 deletions core/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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+)(.*)'
Expand Down

0 comments on commit 2b44d0a

Please sign in to comment.