Added default command_prefix to code.

This commit is contained in:
Luke Rogers 2012-05-08 18:21:09 +12:00
parent 8396b7d36c
commit 39664a6217

View file

@ -140,7 +140,7 @@ def match_command(command):
def main(conn, out):
inp = Input(conn, *out)
commandprefix = conn.conf.get('command_prefix')
commandprefix = conn.conf.get('command_prefix', '.')
# EVENTS
for func, args in bot.events[inp.command] + bot.events['*']:
@ -149,9 +149,9 @@ def main(conn, out):
if inp.command == 'PRIVMSG':
# COMMANDS
if inp.chan == inp.nick: # private message, no command prefix
prefix = r'^(?:[' + commandprefix + ']?|'
prefix = '^(?:[%s]?|' % command_prefix
else:
prefix = r'^(?:[' + commandprefix + ']|'
prefix = '^(?:[%s]|' % command_prefix
command_re = prefix + inp.conn.nick
command_re += r'[,;:]+\s+)(\w+)(?:$|\s+)(.*)'