2
# Plugin for searching doc.ubuntu-es.org for info.
3
# Based on Google plugin.
4
# Changes by Jonathan Patrick Davies <jpatrick@kubuntu.org>
12
class DocUbuntuEsPlugin < Plugin
13
def help(plugin, topic = "")
14
"doc <parabla> => buscar doc.ubuntu-es.org para <parabla>"
17
unless(m.params && m.params.length > 0)
18
m.reply "uso incorrecto: " + help(m.plugin)
21
searchfor = URI.escape m.params
23
query = "/search?hl=es&q=site%3Adoc.ubuntu-es.org+#{searchfor}&btnI=I%27m%20feeling%20lucky"
24
# If we can't find it we tro
25
result = "¡No encontrado! El equipo ubuntu-es-doc necessita tu ayuda! http://doc.ubuntu-es.org"
31
if(ENV['http_proxy'] =~ /^http:\/\/(.+):(\d+)$/)
37
http = @bot.httputil.get_proxy(URI.parse("http://www.google.es"))
41
resp = http.get(query)
43
result = resp['location']
48
if e.response && e.response['location']
49
result = e.response['location']
54
m.reply "#{m.params}: #{result}"
58
plugin = DocUbuntuEsPlugin.new
59
plugin.register("doc")