h/plugins/sieve.py

30 lines
611 B
Python
Raw Normal View History

2008-06-09 11:59:56 +00:00
import re
import hook
@hook.sieve
2009-03-16 18:57:06 +00:00
def sieve_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
2009-03-24 22:53:56 +00:00
input.inp = ' '.join(input.re.groups())
2009-03-15 03:06:36 +00:00
2008-06-09 11:59:56 +00:00
return input