e92d66bd by Barry

Added a count to how many are shown from gamesplayed so you can see the whole list.

1 parent d0be16f0
...@@ -236,7 +236,7 @@ Messages: ...@@ -236,7 +236,7 @@ Messages:
236 !msg <username> on 12/22/2015 Happy Birthday! 236 !msg <username> on 12/22/2015 Happy Birthday!
237 Games: 237 Games:
238 !games <username> - Returns a list of games played for a username. 238 !games <username> - Returns a list of games played for a username.
239 !gameslist - Returns a list of the top 20 games and the number of people who have played that game. 239 !gameslist <count> - Returns a list of the top 20 games and the number of people who have played that game. if you pass a limit it will show that many games instead.
240 !whoplayed <gamename> - Returns a list of players who have played the game. 240 !whoplayed <gamename> - Returns a list of players who have played the game.
241 Spam: 241 Spam:
242 !youtube <search term> - Returns the first video from the search results for the search term. 242 !youtube <search term> - Returns the first video from the search results for the search term.
...@@ -340,6 +340,11 @@ Stuff: ...@@ -340,6 +340,11 @@ Stuff:
340 if not data: 340 if not data:
341 client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention())) 341 client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
342 else: 342 else:
343 parts = message.content.split(' ')
344 limit = 20
345 if parts[1].isdigit():
346 limit = int(parts[1])
347
343 game_list = [] 348 game_list = []
344 for user in data: 349 for user in data:
345 if 'games_played' in data[user]: 350 if 'games_played' in data[user]:
...@@ -347,7 +352,7 @@ Stuff: ...@@ -347,7 +352,7 @@ Stuff:
347 352
348 game_list += data[user]['games_played'] 353 game_list += data[user]['games_played']
349 print('%s' % game_list) 354 print('%s' % game_list)
350 games_sorted = leaders(get_game_names(game_list)) 355 games_sorted = leaders(get_game_names(game_list), top=limit)
351 print('%s' % games_sorted) 356 print('%s' % games_sorted)
352 out_string = '' 357 out_string = ''
353 for game in games_sorted: 358 for game in games_sorted:
......