diff -r 1818d56c8ff5 -r a2fe9ba3041a mod_util.py --- a/mod_util.py Mon Nov 10 02:11:57 2014 +0200 +++ b/mod_util.py Mon Nov 10 02:30:31 2014 +0200 @@ -1,5 +1,6 @@ import math import urllib2 +import json from modulecore import command_error ModuleData = { @@ -53,7 +54,7 @@ def cmd_ud (bot, args, replyto, **rest): try: - url = 'http://api.urbandictionary.com/v0/define?term=%s' % ('%20'.join (args)) + url = 'http://api.urbandictionary.com/v0/define?term=%s' % (args['term'].replace (' ', '%20')) response = urllib2.urlopen (url).read() data = json.loads (response) @@ -67,7 +68,6 @@ definition = data['list'][0]['definition'].replace ('\r', ' ').replace ('\n', ' ').replace (' ', ' ') up = data['list'][0]['thumbs_up'] down = data['list'][0]['thumbs_down'] - bot.privmsg (replyto, "\002%s\002: %s\0033 %d\003 up,\0035 %d\003 down" % - (word, definition, up, down)) + bot.privmsg (replyto, "\002%s\002: %s\0033 %d\003 up,\0035 %d\003 down" % (word, definition, up, down)) except Exception as e: command_error ('Urban dictionary lookup failed: %s' % e) \ No newline at end of file