def noteuri(jenni, input): if blacklist.user(input.nick): return uri = input.group(1).encode('utf-8') if not hasattr(jenni, 'last_seen_uri'): jenni.last_seen_uri = {} jenni.last_seen_uri[input.sender] = uri
def wik(jenni, input): if blacklist.user(input.nick): return origterm = input.groups()[1] if not origterm: return jenni.say('Perhaps you meant ".wik Zen"?') origterm = origterm.encode('utf-8') origterm = origterm.strip() term = urllib.unquote(origterm) if blacklist.term(term, input.nick): return language = 'en' if term.startswith(':') and (' ' in term): a, b = term.split(' ', 1) a = a.lstrip(':') if a.isalpha(): language, term = a, b term = term[0].upper() + term[1:] term = term.replace(' ', '_') try: result = wikipedia(term, language) except IOError: args = (language, wikiuri % (language, term)) error = "Can't connect to %s.wikipedia.org (%s)" % args return jenni.say(error) if result is not None: jenni.say(result) else: jenni.say('Can\'t find anything in Wikipedia for "%s".' % origterm)
def collect_links(jenni, input): if blacklist.user(input.nick): return link = input.groups() channel = input.sender link = link[0] if not hasattr(jenni, 'last_seen_uri'): jenni.last_seen_uri = dict() jenni.last_seen_uri[channel] = link
def show_title_auto(jenni, input): if blacklist.user(input.nick): return '''No command - Automatically displays titles for URLs''' for each in BLOCKED_MODULES: if input.startswith('.%s ' % (each)): ## Don't want it to show duplicate titles return if len(re.findall('\([\d]+\sfiles\sin\s[\d]+\sdirs\)', input)) == 1: ## Directory Listing of files return try: status, results = get_results(input) except Exception, e: print '[%s]' % e, input return