Skip to content

Legobot/legos.wtf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wikipedia Top Finder

Travis PyPI PyPI

PyPI PyPI PyPI

Ever wish you could do an "I'm feeling lucky" search on Wikipedia right from chat? Want to be able to pull up a wikipedia link right there in the group and settle the debate once and for all? This module will search the English langauge Wikipedia for the query you provide and return the URL for the top matching page.

Usage

This lego listens for !wtf at the beginning of a message and processes everything after it as a query.

Example: !wtf python will return https://en.wikipedia.org/wiki/Python

Installation

pip3 install legos.wtf

This is a Lego designed for use with Legobot, so you'll get Legobot along with this. To deploy it, import the package and add it to the active legos like so:

# This is the legobot stuff
from Legobot import Lego
# This is your lego
from legos.wtf import WikipediaTopFinder

# Legobot stuff here
lock = threading.Lock()
baseplate = Lego.start(None, lock)
baseplate_proxy = baseplate.proxy()

# Add your lego
baseplate_proxy.add_child(WikipediaTopFinder)

Tweaking

While you can use this one as-is, you could also add a localized version to your Legobot deployment by grabbing wtf.py and deploying is as a local module. Example of a Legobot instance with local modules

Contributing

As always, pull requests are welcome.