diff options
author | 2020-03-02 17:51:02 +0200 | |
---|---|---|
committer | 2020-03-02 17:51:02 +0200 | |
commit | d4bbf9a7a548341c77f55039e4a7689e1f1ee6ac (patch) | |
tree | ed55bde060b9ce7cb3d3fa4f1723c0dca8ec171c | |
parent | (Games Cog): Fixed and added content to docstrings. (diff) |
(Games Cog): Added comments about offsets, use keyword parameters for get_companies_list.
-rw-r--r-- | bot/seasons/evergreen/game.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/seasons/evergreen/game.py b/bot/seasons/evergreen/game.py index 46fdc689..08068c23 100644 --- a/bot/seasons/evergreen/game.py +++ b/bot/seasons/evergreen/game.py @@ -186,6 +186,8 @@ class Games(Cog): return # Get games listing, if genre don't exist, show error message with possibilities. + # Offset must be random, due otherwise we will get always same result (offset show in which position should + # API start returning result) try: games = await self.get_games_list(amount, self.genres[genre], offset=random.randint(0, 150)) @@ -239,7 +241,9 @@ class Games(Cog): await ctx.send("Your provided amount is out of range. Our minimum is 1 and maximum 25.") return - companies = await self.get_companies_list(amount, random.randint(0, 150)) + # Get companies listing. Provide limit for limiting how much companies will be returned. Get random offset to + # get (almost) every time different companies (offset show in which position should API start returning result) + companies = await self.get_companies_list(limit=amount, offset=random.randint(0, 150)) pages = [await self.create_company_page(co) for co in companies] await ImagePaginator.paginate(pages, ctx, Embed(title="Random Game Companies")) |