Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 22nd, 2012  |  syntax: Python  |  size: 0.63 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. from util import hook
  2. from util import http
  3. from urllib import quote_plus
  4. #let me google that for you plugin
  5. @hook.command('gfy')
  6. @hook.command('lmgtfy')
  7. @hook.command
  8. def googleit(inp, say=None, me=None, nick=None):
  9.     ".lmgtfy (user)! [phrase] - Posts a google link for the specified phrase"
  10.     if inp.find('!')==-1:
  11.         phraseP = quote_plus(inp)
  12.         url = "http://lmgtfy.com/?q=" + phraseP
  13.         say(url)
  14.     else:
  15.         split = inp.split("! ")
  16.         phrase = split[1]
  17.         user = split[0]
  18.         phraseP = quote_plus(phrase)
  19.         url = "http://lmgtfy.com/?q=" + phraseP
  20.         say(user + "! " + url)