async def test_player_endpoints(self): self.time_track(None) print("Testing player endpoints.") client = rocket_snake.RLS_Client(api_key=config["key"], auto_rate_limit=True) pprint(await client.search_player("Mike", get_all=False)) print("Me:") self.time_track(None) print( str(await client.get_player(config["steam_ids"][0], rocket_snake.constants.STEAM))) self.time_track("Time taken for single player was {0} seconds.") print("Loads a people:") self.time_track(None) pprint(await client.get_players( list( zip(config["steam_ids"], [rocket_snake.constants.STEAM] * len(config["steam_ids"]))) )) self.time_track("Time taken for batch players was {0} seconds.") print( "Done with testing player endpoints. Time taken was {0} seconds.§". format( self.time_track( "Time taken for player endpoints was {0} seconds.")))
async def example_function(): client = rs.RLS_Client("API KEY GOES HERE") print("\nPlaylists:") pprint(await client.get_playlists()) print("\nSeasons:") pprint(await client.get_seasons()) print("\nPlatforms:") pprint(await client.get_platforms()) print("\nTiers:") pprint(await client.get_tiers())
async def test_player_search(self): self.time_track(None) print("Testing player search.") client = rocket_snake.RLS_Client(api_key=config["key"], auto_rate_limit=True) pprint(await client.search_player("Mike", get_all=False)) print("Done with testing player search. Time taken was {0} seconds.". format( self.time_track( "Time taken for player search was {0} seconds.")))
async def test_playlists_throughput(self): self.time_track(None) print("Testing playlists data throughput.") client = rocket_snake.RLS_Client(api_key=config["key"], auto_rate_limit=True) done_requests = await self.do_multiple( client.get_playlists, text="playlists took {0} seconds.") print( "Done with playlists data throughput testing, {0} requests were executed. \nThat means an average of {1} milliseconds per request." .format( done_requests, round( 1000 * (self.time_track( "Time taken for playlists data throughput was {0} seconds." ) / done_requests), 1)))
async def test_data_endpoints(self): self.time_track(None) print("Testing data endpoints.") client = rocket_snake.RLS_Client(api_key=config["key"], auto_rate_limit=True) print("Playlists:") pprint(await client.get_playlists()) print("\nSeasons:") pprint(await client.get_seasons()) print("\nPlatforms:") pprint(await client.get_platforms()) print("\nTiers:") pprint(await client.get_tiers()) print("\n") self.executed_requests += 7 print("Done with testing data endpoints. Time taken was {0} seconds.". format( self.time_track( "Time taken for data endpoints was {0} seconds.")))
async def rlstats(ctx, player): client = rs.RLS_Client("7GLWZDHT8G884IJJJ5OYVJTVM90WGQ2R") client.get_player(str(player))
@bot.command(name='mutate') async def mutate(ctx): embed = discord.Embed(title='Randomized Mutators', colour=discord.Colour.blue()) for key in mutators.data: mutate = random.choice(mutators.data[key]) embed.add_field(name=key, value=mutate) await ctx.send(embed=embed) @bot.command(name='f**k') async def f**k(ctx): await bot.close() if __name__ == '__main__': mutators = Pyson('mutators') # get discord token with open('token.txt') as token: token = token.readline() with open('rlstoken.txt') as rlstoken: rlstoken = rlstoken.readline() rlsclient = rs.RLS_Client(rlstoken.strip()) bot.loop.run_until_complete(bot.run(token.strip()))