ignore *bot with possibility for exception

This commit is contained in:
Ryan Hitchman 2009-03-30 17:58:19 -06:00
parent aead137ed7
commit 1a48955ee1
2 changed files with 10 additions and 9 deletions

View File

@ -6,7 +6,7 @@ posts everything buttbot says to the iambuttbot twitter account
import urllib
import hook
@hook.command(hook=r'(.*)', prefix=False)
@hook.command(hook=r'(.*)', prefix=False, ignorebots=False)
def iambuttbot(bot, input):
if input.nick.lower() != 'buttbot':
return

View File

@ -4,18 +4,19 @@ import hook
@hook.sieve
def sieve_suite(bot, input, func, args):
args.setdefault('events', ['PRIVMSG'])
events = args.get('events', ['PRIVMSG'])
if input.command not in args['events']:
if args['events'] != '*':
if input.command not in events and events != '*':
return None
args.setdefault('hook', r'(.*)')
if input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True):
return None
hook = args.get('hook', r'(.*)')
args.setdefault('prefix', True)
hook = args['hook']
if args['prefix']:
hook = bot.commandprefix + args['hook']
if args.get('prefix', True):
hook = bot.commandprefix + hook
if input.command == 'INVITE':
print func, hook