- .idgames now works with the page system

Wed, 31 Dec 2014 15:49:11 -0500

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 31 Dec 2014 15:49:11 -0500
changeset 114
0d1fd111cb22
parent 113
08e9b1c1b324
child 115
2bb5c4578ee1

- .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

mercurial