async def who(ctx, player): try: char = PhoenixParser(player) p = char.info rr = RealmRanks(p.player_rr, int(p.rp_all_time_amount.replace(",", ""))) embed = discord.Embed( title="{}, ({} {})".format( p.player_name, p.player_race, p.player_class), url=p.player_url, description="Guild: {} - Level: {}".format( p.player_guild, p.player_level), color=p.realm_color ) embed.add_field( name="Total: {} - {} ({})".format( p.rp_all_time_amount, p.player_rr, p.player_pretty_rr), value="Left to, {}: {}, {}: {}\n\ Server: #{} - {}: #{} - {}: #{}".format( rr.next_rank(pretty=True), rr.next_rank(), rr.next_level(pretty=True), rr.next_level(), p.rp_all_time_server, p.player_realm, p.rp_all_time_realm, p.player_class, p.rp_all_time_class), inline=False) embed.add_field( name="Last Week: {}".format( p.rp_last_week_amount), value="Server: #{} - {}: #{} - {}: #{}".format( p.rp_last_week_server, p.player_realm, p.rp_last_week_realm, p.player_class, p.rp_last_week_class), inline=False) embed.add_field( name="This Week: {}".format( p.rp_this_week_amount), value="Server: #{} - {}: #{} - {}: #{}".format( p.rp_this_week_server, p.player_realm, p.rp_this_week_realm, p.player_class, p.rp_this_week_class), inline=False) embed.add_field( name="Last 48 hours: {}".format( p.rp_last_48h_amount), value="Server: #{} - {}: #{} - {}: #{}".format( p.rp_last_48h_server, p.player_realm, p.rp_last_48h_realm, p.player_class, p.rp_last_48h_class), inline=False) embed.set_footer(text="Updated: {}".format(p.last_updated)) await ctx.send(embed=embed) except Exception: embed = discord.Embed( title="Unable to find player {}".format(player), description="This player does not exist or was misspelled", color=16312092 ) await ctx.send(embed=embed)
def test_next_level_rr14l1_pretty(self): # Yes, this should return R14L0, since we don't have higher rank rr = RealmRanks("14L1") self.assertEqual(rr.next_level(pretty=True), "R14L0")
def test_set_rp(self): rr = RealmRanks("1L1") rr.set_rp(50) self.assertEqual(rr.current_rp, 50)
def test_next_level_rr5l9_pretty(self): rr = RealmRanks("5L9") self.assertEqual(rr.next_level(pretty=True), "R6L0")
def test_next_level_rr14l1(self): # Yes, this should return rr14l0 value, since we don't have higher rank rr = RealmRanks("14L1") self.assertEqual(rr.next_level(), "187,917,143")
def test_next_level_rr1l2_pretty(self): rr = RealmRanks("1L2") self.assertEqual(rr.next_level(pretty=True), "R1L3")
def test_next_level_rr5l9(self): rr = RealmRanks("5L9") self.assertEqual(rr.next_level(), "1,010,625")
def test_get_level_rr14l4(self): # Yes, this should return 0, since we don't have higher rank rr = RealmRanks("14L4") self.assertEqual(rr.get_level(), 0)
def test_next_level_rr1l2(self): rr = RealmRanks("1L2") self.assertEqual(rr.next_level(), "125")
def test_get_level_rr2l9(self): rr = RealmRanks("2L9") self.assertEqual(rr.get_level(), 9)
def test_get_level_rr6l0(self): rr = RealmRanks("6L0") self.assertEqual(rr.get_level(), 0)
def test_get_level_rr1l5(self): rr = RealmRanks("1L5") self.assertEqual(rr.get_level(), 5)
def test_get_rank_rr15(self): # Yes, this should return 14, since we don't have higher rank rr = RealmRanks("15L6") self.assertEqual(rr.get_rank(), 14)
def test_get_rank_rr14(self): rr = RealmRanks("14L0") self.assertEqual(rr.get_rank(), 14)
def test_get_rank_rr5(self): rr = RealmRanks("5L9") self.assertEqual(rr.get_rank(), 5)
def test_get_rank_rr1(self): rr = RealmRanks("1L2") self.assertEqual(rr.get_rank(), 1)