h/plugins/filter.py

30 lines
612 B
Python
Raw Normal View History

2008-06-09 11:59:56 +00:00
import re
import hook
@hook.sieve
def filter_suite(bot, input, func, args):
2008-06-09 11:59:56 +00:00
args.setdefault('events', ['PRIVMSG'])
if input.command not in args['events']:
2009-03-15 03:06:36 +00:00
if args['events'] != '*':
return None
2008-06-09 11:59:56 +00:00
args.setdefault('hook', r'(.*)')
args.setdefault('prefix', True)
hook = args['hook']
if args['prefix']:
hook = bot.commandprefix + args['hook']
if input.command == 'INVITE':
print func, hook
2009-03-15 03:06:36 +00:00
input.re = re.match(hook, input.msg)
if input.re is None:
return None
input.inp = ' '.join(input.re.groups())
2008-06-09 11:59:56 +00:00
return input