Skip to content

Instantly share code, notes, and snippets.

@initbrain
Created September 19, 2013 22:37
Show Gist options
  • Save initbrain/6630822 to your computer and use it in GitHub Desktop.
Save initbrain/6630822 to your computer and use it in GitHub Desktop.
XChat Script (IRC client) - Make an "Let me Google That For You" url and send it to current channel
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import xchat, urllib
__module_name__ = "pyLmgtfy"
__module_version__ = "0.1"
__module_description__ = "Make an \"Let me Google That For You\" url and send it to current channel"
__module_author__ = "initbrain"
def onLmgtfy(word, word_eol, userdata):
if len(word) < 2:
print "Usage: /lmgtfy <google search>"
else:
# make the url
lmgtfy="http://lmgtfy.com/?q="+urllib.quote((' ').join(word[1:]));
# display
xchat.command("MSG " + xchat.get_info("channel") + " " + lmgtfy)
return xchat.EAT_ALL
xchat.hook_command("lmgtfy", onLmgtfy, help="/lmgtfy <google search>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment