Skip to content

Commit

Permalink
Adds a new GBP finding command (#32)
Browse files Browse the repository at this point in the history
`finduntil`, with a number as an argument will print every user up until
that position on the leaderboard
  • Loading branch information
SuperNovaa41 authored Apr 16, 2022
1 parent 8cf401d commit 35bfa0c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gbp/gbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,19 @@ async def findgbp(self, ctx, gbp_to_find):
await ctx.send(file=utils.chat_formatting.text_to_file(msg, "gbp.txt"))
else:
await ctx.send(f"```{msg}```")

@commands.command()
async def finduntil(self, ctx, up_to_pos):
msg = ""
gbp_dict = await self.config.gbp()
for i in range(1, len(gbp_dict) + 1):
if int(up_to_pos) < i:
break
msg += "#" + str(i) + ": " + gbp_dict[str(i)][0] + " (" + str(gbp_dict[str(i)][1]) + " GBP)\n"
if (msg == ""):
await ctx.send("An error has occured!")
return
if (len(msg) >= 2000):
await ctx.send(file=utils.chat_formatting.text_to_file(msg, "gbp.txt"))
else:
await ctx.send(f"```{msg}```")

0 comments on commit 35bfa0c

Please sign in to comment.