Wed, 31 Dec 2014 15:49:11 -0500
- .idgames now works with the page system
mod_idgames.py | file | annotate | diff | comparison | revisions |
--- a/mod_idgames.py Wed Dec 31 11:40:46 2014 -0500 +++ b/mod_idgames.py Wed Dec 31 15:49:11 2014 -0500 @@ -18,7 +18,7 @@ g_idgamesSearchURL = 'http://www.doomworld.com/idgames/api/api.php?action=search&query=%s&type=title&sort=date&out=json' -def cmd_idgames (bot, args, replyto, **rest): +def cmd_idgames (bot, args, reply, **rest): try: url = g_idgamesSearchURL % urllib.quote (args['wad']) response = urllib2.urlopen (url).read() @@ -30,18 +30,10 @@ else: files = [data['content']['file']] - i = 0 - for filedata in files: - if i >= 5: - break - - bot.privmsg (replyto, '- %s: \'%s\' by \'%s\', rating: %s: %s' % \ - (filedata['filename'], filedata['title'], filedata['author'], filedata['rating'], filedata['url'])) - - i += 1 - #done - bot.privmsg (replyto, "(%d / %d results posted)" % (i, len(files))) + reply ('- %s: \'%s\' by \'%s\', rating: %s: %s' % \ + (filedata['filename'], filedata['title'], filedata['author'], + filedata['rating'], filedata['url'])) elif 'warning' in data and 'message' in data['warning']: command_error (data['warning']['message']) elif 'error' in data and 'message' in data['error']: @@ -50,5 +42,3 @@ command_error ("Incomplete JSON response from doomworld.com/idgames") except Exception as e: command_error ('search failed: %s' % str (e)) - #tried -#enddef \ No newline at end of file