Example #1
0
 async def best(self, ctx):
     _("""Shows the best players of your guild by XP.""")
     await ctx.trigger_typing()
     async with self.bot.pool.acquire() as conn:
         guild = await conn.fetchrow(
             'SELECT * FROM guild WHERE "id"=$1;', ctx.character_data["guild"]
         )
         players = await conn.fetch(
             'SELECT "user", "name", "xp" FROM profile WHERE "guild"=$1 ORDER BY "xp" DESC LIMIT 10;',
             guild["id"],
         )
     result = ""
     for idx, profile in enumerate(players):
         charname = await rpgtools.lookup(self.bot, profile[0])
         text = _(
             "{name}, a character by {charname} with Level **{level}** (**{xp}** XP)"
         ).format(
             charname=escape_markdown(charname),
             name=escape_markdown(profile["name"]),
             level=rpgtools.xptolevel(profile["xp"]),
             xp=profile["xp"],
         )
         result = f"{result}{idx + 1}. {text}\n"
     await ctx.send(
         embed=discord.Embed(
             title=_("The Best Players of {name}").format(name=guild["name"]),
             description=result,
             colour=0xE7CA01,
         )
     )
Example #2
0
 async def richest(self, ctx):
     _("""Shows the richest players in your guild.""")
     await ctx.trigger_typing()
     async with self.bot.pool.acquire() as conn:
         guild = await conn.fetchrow(
             'SELECT * FROM guild WHERE "id"=$1;', ctx.character_data["guild"]
         )
         players = await conn.fetch(
             'SELECT "user", "name", "money" from profile WHERE "guild"=$1 ORDER BY "money" DESC LIMIT 10;',
             guild["id"],
         )
     result = ""
     for idx, profile in enumerate(players):
         charname = await rpgtools.lookup(self.bot, profile["user"])
         text = _("a character by {charname} with **${money}**").format(
             charname=escape_markdown(charname), money=profile["money"]
         )
         result = f"{result}{idx + 1}. {escape_markdown(profile['name'])}, {text}\n"
     await ctx.send(
         embed=discord.Embed(
             title=_("The Richest Players of {guild}").format(guild=guild["name"]),
             description=result,
             colour=0xE7CA01,
         )
     )
Example #3
0
 async def richest(self, ctx):
     _("""The 10 most richest players in IdleRPG.""")
     await ctx.trigger_typing()
     players = await self.bot.pool.fetch(
         'SELECT "user", "name", "money" FROM profile ORDER BY "money" DESC'
         " LIMIT 10;")
     result = ""
     for idx, profile in enumerate(players):
         username = await rpgtools.lookup(self.bot, profile["user"])
         text = _(
             "{name}, a character by {username} with **${money}**").format(
                 name=escape_markdown(profile["name"]),
                 username=escape_markdown(username),
                 money=profile["money"],
             )
         result = f"{result}{idx + 1}. {text}\n"
     result = discord.Embed(title=_("The Richest Players"),
                            description=result,
                            colour=0xE7CA01)
     await ctx.send(embed=result)
Example #4
0
 async def pvpstats(self, ctx):
     _("""Top 10 players by wins in PvP matches.""")
     await ctx.trigger_typing()
     players = await self.bot.pool.fetch(
         'SELECT "user", "name", "pvpwins" from profile ORDER BY "pvpwins" DESC LIMIT 10;'
     )
     result = ""
     for idx, profile in enumerate(players):
         username = await rpgtools.lookup(self.bot, profile["user"])
         text = _("{name}, a character by {username} with **{wins}** wins"
                  ).format(
                      name=escape_markdown(profile["name"]),
                      username=escape_markdown(username),
                      wins=profile["pvpwins"],
                  )
         result = f"{result}{idx + 1}. {text}\n"
     result = discord.Embed(title=_("The Best PvPers"),
                            description=result,
                            colour=0xE7CA01)
     await ctx.send(embed=result)
Example #5
0
 async def highscore(self, ctx):
     _("""The top 10 players by XP.""")
     await ctx.trigger_typing()
     players = await self.bot.pool.fetch(
         'SELECT "user", "name", "xp" from profile ORDER BY "xp" DESC LIMIT 10;'
     )
     result = ""
     for idx, profile in enumerate(players):
         username = await rpgtools.lookup(self.bot, profile["user"])
         text = _(
             "{name}, a character by {username} with Level **{level}** (**{xp}** XP)"
         ).format(
             name=escape_markdown(profile["name"]),
             username=escape_markdown(username),
             level=rpgtools.xptolevel(profile["xp"]),
             xp=profile["xp"],
         )
         result = f"{result}{idx + 1}. {text}\n"
     result = discord.Embed(title=_("The Best Players"),
                            description=result,
                            colour=0xE7CA01)
     await ctx.send(embed=result)
Example #6
0
 async def ladder(self, ctx):
     _("""The best GvG guilds.""")
     guilds = await self.bot.pool.fetch(
         "SELECT * FROM guild ORDER BY wins DESC LIMIT 10;"
     )
     result = ""
     for idx, guild in enumerate(guilds):
         leader = await rpgtools.lookup(self.bot, guild["leader"])
         text = _("a guild by {leader} with **{wins}** GvG Wins").format(
             leader=escape_markdown(leader), wins=guild["wins"]
         )
         result = f"{result}{idx + 1}. {guild['name']}, {text}\n"
     await ctx.send(
         embed=discord.Embed(
             title=_("The Best GvG Guilds"), description=result, colour=0xE7CA01
         )
     )