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 urllib
import hook import hook
@hook.command(hook=r'(.*)', prefix=False) @hook.command(hook=r'(.*)', prefix=False, ignorebots=False)
def iambuttbot(bot, input): def iambuttbot(bot, input):
if input.nick.lower() != 'buttbot': if input.nick.lower() != 'buttbot':
return return

View File

@ -4,18 +4,19 @@ import hook
@hook.sieve @hook.sieve
def sieve_suite(bot, input, func, args): def sieve_suite(bot, input, func, args):
args.setdefault('events', ['PRIVMSG']) events = args.get('events', ['PRIVMSG'])
if input.command not in args['events']: if input.command not in events and events != '*':
if args['events'] != '*': return None
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) args.setdefault('prefix', True)
hook = args['hook'] if args.get('prefix', True):
if args['prefix']: hook = bot.commandprefix + hook
hook = bot.commandprefix + args['hook']
if input.command == 'INVITE': if input.command == 'INVITE':
print func, hook print func, hook