Skip to content

Instantly share code, notes, and snippets.

@x13machine
Last active December 21, 2016 10:25
Show Gist options
  • Save x13machine/917ae8ddd765baa2bea98ccad5710c53 to your computer and use it in GitHub Desktop.
Save x13machine/917ae8ddd765baa2bea98ccad5710c53 to your computer and use it in GitHub Desktop.
Urban Dictionary addon for Hexchat
""""
Usage: /ud <word>
Creator: x13machine <https://github.com/x13machine>
License: WTFPL <http://www.wtfpl.net/>
""""
__module_name__ = "Urban Dictionary"
__module_version__ = "1.0"
__module_description__ = "Gets the Urban Dictionary"
import hexchat
import requests
def ud(word, word_eol, userdata):
try:
r = requests.get('http://api.urbandictionary.com/v0/define', params={'term':word_eol[1]})
hexchat.prnt('Urban Dictionary: ' + r.json()['list'][0]['definition'])
except:
hexchat.prnt('Urban Dictionary: ENGLISH, MOTHERFUCKER DO YOU SPEAK IT???')
hexchat.hook_command('ud', ud, help='UD <word>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment