2008-06-09 11:59:56 +00:00
|
|
|
import re
|
|
|
|
|
2009-03-16 04:30:46 +00:00
|
|
|
import hook
|
|
|
|
|
|
|
|
@hook.sieve
|
2009-03-16 18:57:06 +00:00
|
|
|
def sieve_suite(bot, input, func, args):
|
2009-03-30 23:58:19 +00:00
|
|
|
events = args.get('events', ['PRIVMSG'])
|
2008-06-09 11:59:56 +00:00
|
|
|
|
2009-03-30 23:58:19 +00:00
|
|
|
if input.command not in events and events != '*':
|
|
|
|
return None
|
|
|
|
|
|
|
|
if input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True):
|
|
|
|
return None
|
2008-06-09 11:59:56 +00:00
|
|
|
|
2009-03-30 23:58:19 +00:00
|
|
|
hook = args.get('hook', r'(.*)')
|
2008-06-09 11:59:56 +00:00
|
|
|
args.setdefault('prefix', True)
|
|
|
|
|
2009-03-30 23:58:19 +00:00
|
|
|
if args.get('prefix', True):
|
2009-04-17 23:12:40 +00:00
|
|
|
hook = r'^(?:[.!]|' + bot.nick +r'[:,]*\s*)' + hook
|
2008-06-09 11:59:56 +00:00
|
|
|
|
2009-03-16 04:30:46 +00:00
|
|
|
if input.command == 'INVITE':
|
|
|
|
print func, hook
|
|
|
|
|
2009-04-01 23:09:06 +00:00
|
|
|
input.re = re.match(hook, input.msg, flags=re.I)
|
2009-03-15 03:06:36 +00:00
|
|
|
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
|