2015-09-05 21:44:46 -07:00
|
|
|
#!/ysr/bin/env python3
|
|
|
|
|
|
|
|
"""
|
|
|
|
.. module::LMGTFY
|
2015-11-01 18:03:11 -08:00
|
|
|
:synopsis: LMGTFY
|
2015-09-05 21:44:46 -07:00
|
|
|
.. moduleauthor::Nick Krichevsky <nick@ollien.com>
|
|
|
|
"""
|
|
|
|
|
2015-09-05 22:26:19 -07:00
|
|
|
import urllib.parse
|
2017-11-27 18:58:20 -08:00
|
|
|
from pyircbot.modulebase import ModuleBase, command
|
|
|
|
from pyircbot.modules.ModInfo import info
|
2015-09-05 21:44:46 -07:00
|
|
|
|
|
|
|
BASE_URL = "http://lmgtfy.com/?q="
|
|
|
|
|
2017-01-01 14:59:01 -08:00
|
|
|
|
2015-09-05 21:44:46 -07:00
|
|
|
class LMGTFY(ModuleBase):
|
2017-11-27 18:58:20 -08:00
|
|
|
|
|
|
|
@info("lmgtfy <term> display a condescending internet query", cmds=["lmgtfy"])
|
|
|
|
@command("lmgtfy", require_args=True)
|
|
|
|
def handleMessage(self, msg, cmd):
|
2018-02-10 16:44:51 -08:00
|
|
|
link = self.createLink(cmd.args_str)
|
|
|
|
self.bot.act_PRIVMSG(msg.args[0], "{}: {}".format(msg.prefix.nick, link))
|
2017-01-01 14:59:01 -08:00
|
|
|
|
2015-11-01 18:03:11 -08:00
|
|
|
def createLink(self, message):
|
2018-02-10 16:44:51 -08:00
|
|
|
return BASE_URL + "+".join([urllib.parse.quote(word) for word in message.split()])
|