コード例 #1
0
ファイル: apertium_wiki.py プロジェクト: goavki/phenny
def apertium_wiki(phenny, origterm, to_nick=None):
    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints, None)
    match = w.search(term)

    if not match:
        phenny.say('Can\'t find anything in the Apertium Wiki for "{0}".'.format(term))
        return

    snippet, url = wiki.extract_snippet(match, section)

    if to_nick:
        phenny.say(truncate(snippet, to_nick + ', "{}" - ' + url))
    else:
        phenny.say(truncate(snippet, '"{}" - ' + url))
コード例 #2
0
ファイル: apertium_wiki.py プロジェクト: LuccoJ/phenny
def apertium_wiki(phenny, origterm, to_nick=None):
    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints, None)
    match = w.search(term)

    if not match:
        phenny.say('Can\'t find anything in the Apertium Wiki for "{0}".'.format(term))
        return

    snippet, url = wiki.extract_snippet(match, section)

    if to_nick:
        phenny.say(truncate(snippet, to_nick + ', "{}" - ' + url))
    else:
        phenny.say(truncate(snippet, '"{}" - ' + url))
コード例 #3
0
ファイル: archwiki.py プロジェクト: mutantmonkey/phenny
def awik(phenny, input): 
    """.awik <term> - Look up something on the ArchWiki."""

    origterm = input.group(1)
    if not origterm:
        return phenny.say('Perhaps you meant ".awik dwm"?')

    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints)
    match = w.search(term)

    if not match:
        phenny.say('Can\'t find anything in the ArchWiki for "{0}".'.format(term))
        return

    snippet, url = wiki.extract_snippet(match, section)

    phenny.say('"{0}" - {1}'.format(snippet, url))
コード例 #4
0
ファイル: vtluugwiki.py プロジェクト: vtluug/phenny
def vtluug(phenny, input): 
    """.vtluug <term> - Look up something on the VTLUUG wiki."""

    origterm = input.groups()[1]
    if not origterm: 
        return phenny.say('Perhaps you meant ".vtluug VT-Wireless"?')

    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints)
    match = w.search(term)

    if not match:
        phenny.say('Can\'t find anything in the VTLUUG Wiki for "{0}".'.format(term))
        return

    snippet, url = wiki.extract_snippet(match, section)

    phenny.say('"{0}" - {1}'.format(snippet, url))
コード例 #5
0
def awik(phenny, input):
    """.awik <term> - Look up something on the ArchWiki."""

    origterm = input.group(1)
    if not origterm:
        return phenny.say('Perhaps you meant ".awik dwm"?')

    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints)
    match = w.search(term)

    if not match:
        phenny.say(
            'Can\'t find anything in the ArchWiki for "{0}".'.format(term))
        return

    snippet, url = wiki.extract_snippet(match, section)

    phenny.say('"{0}" - {1}'.format(snippet, url))
コード例 #6
0
ファイル: wikipedia.py プロジェクト: mutantmonkey/phenny
def wik(phenny, input): 
    """.wik <term> - Look up something on Wikipedia."""

    origterm = input.groups()[1]
    if not origterm: 
        return phenny.say('Perhaps you meant ".wik Zen"?')

    origterm = origterm.strip()
    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints)
    match = w.search(term)

    if not match:
        phenny.say('Can\'t find anything in Wikipedia for "{0}".'.format(origterm))
        return

    snippet, url = wiki.extract_snippet(match, section)

    phenny.say('"{0}" - {1}'.format(snippet, url))
コード例 #7
0
ファイル: wikipedia.py プロジェクト: vtluug/phenny
def wik(phenny, input):
    """.wik <term> - Look up something on Wikipedia."""

    origterm = input.groups()[1]
    if not origterm:
        return phenny.say('Perhaps you meant ".wik Zen"?')

    origterm = origterm.strip()
    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints)
    match = w.search(term)

    if not match:
        phenny.say(
            'Can\'t find anything in Wikipedia for "{0}".'.format(origterm))
        return

    snippet, url = wiki.extract_snippet(match, section)

    phenny.say('"{0}" - {1}'.format(snippet, url))
コード例 #8
0
ファイル: wikipedia.py プロジェクト: goavki/phenny
def wikipedia(phenny, origterm, lang, to_user=None):
    if not origterm:
        return phenny.say('Perhaps you meant ".wik Zen"?')

    origterm = origterm.strip()
    lang = lang.strip()

    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints, lang)
    match = w.search(term)

    if not match:
        phenny.say('Can\'t find anything in Wikipedia for "{0}".'.format(origterm))
        return

    snippet, url = wiki.extract_snippet(match, section)

    if to_user:
        phenny.say(truncate(snippet, to_user + ', "{}" - ' + url))
    else:
        phenny.say(truncate(snippet, '"{}" - ' + url))
コード例 #9
0
def wikipedia(phenny, origterm, lang, to_user=None):
    if not origterm:
        return phenny.say('Perhaps you meant ".wik Zen"?')

    origterm = origterm.strip()
    lang = lang.strip()

    term, section = wiki.parse_term(origterm)

    w = wiki.Wiki(endpoints, lang)
    match = w.search(term)

    if not match:
        phenny.say(
            'Can\'t find anything in Wikipedia for "{0}".'.format(origterm))
        return

    snippet, url = wiki.extract_snippet(match, section)

    if to_user:
        phenny.say(truncate(snippet, to_user + ', "{}" - ' + url))
    else:
        phenny.say(truncate(snippet, '"{}" - ' + url))