From 1a48955ee1a82860456878b6ba295fcc3f7e6ecb Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Mon, 30 Mar 2009 17:58:19 -0600 Subject: [PATCH] ignore *bot with possibility for exception --- plugins/iambuttbot.py | 2 +- plugins/sieve.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/iambuttbot.py b/plugins/iambuttbot.py index 91f925b..d836575 100644 --- a/plugins/iambuttbot.py +++ b/plugins/iambuttbot.py @@ -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 diff --git a/plugins/sieve.py b/plugins/sieve.py index db921e5..aea4124 100644 --- a/plugins/sieve.py +++ b/plugins/sieve.py @@ -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'] != '*': - return None + 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