Last active
December 16, 2015 17:59
-
-
Save awreece/5474257 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import string | |
def yell_at_problem(willie, trigger): | |
if not trigger.admin: | |
willie.reply("DO NOT DISCUSS PROBLEMS IN CHANNEL. If you need help, pm an op by doing '/query tylerni7' (or another op).") | |
yell_at_problem.rule = '.*(answer|problem).*' | |
yell_at_problem.rate = 60 | |
yell_at_problem.name = 'yell_at_problem' | |
def topic_on_join(willie, trigger): | |
willie.msg(trigger.nick, "Read the topic - don't ask about questions in channel and read http://jeff.jones.be/technology/articles/how-to-ask-for-help-on-irc/") | |
topic_on_join.priority = 'low' | |
topic_on_join.event = 'JOIN' | |
topic_on_join.rule = '.*' | |
def set_regex(willie, trigger): | |
def ours(flist): | |
for f in flist: | |
if f.name == 'yell_at_problem': | |
return True | |
return False | |
if trigger.admin: | |
newstring = string.split(trigger.args[1], ' ', 1)[1] | |
regexp = re.compile(newstring) | |
problem = filter(lambda (r, flist): ours(flist), | |
willie.commands['medium'].iteritems())[0] | |
willie.commands['medium'] = dict(filter(lambda (r, flist): not ours(flist), | |
willie.commands['medium'].iteritems())) | |
# Yeah, no clue why this works. I would expect [problem[1]] to be | |
# necessary. | |
willie.commands['medium'][regexp] = problem[1] | |
willie.reply("Yell regex set to '" + newstring + "'") | |
set_regex.commands = ['setregex'] | |
set_regex.thread = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment