Skip to content
Snippets Groups Projects
Commit 26bf0ca9 authored by Dennis Klein's avatar Dennis Klein
Browse files

Add "all" parameter for romantik board

parent da3392f5
No related branches found
No related tags found
No related merge requests found
......@@ -22,20 +22,20 @@ class Leaderboard(commands.Cog):
async def cmd_highscore(self, ctx, score: int):
""" Add highscore for Dorfromantik leaderboard """
if highscore := self.highscores.get(str(ctx.author.id)):
self.highscores[str(ctx.author.id)] = max(highscore, score)
else:
self.highscores[str(ctx.author.id)] = score
self.save()
await ctx.send(f"Vielen Dank für deine Einreichung. Du bist damit auf Platz {self.get_place(ctx.author.id)} der Rangliste gelandet.")
if score > 50:
if highscore := self.highscores.get(str(ctx.author.id)):
self.highscores[str(ctx.author.id)] = max(highscore, score)
else:
self.highscores[str(ctx.author.id)] = score
self.save()
await ctx.send(
f"Vielen Dank für deine Einreichung. Du bist damit auf Platz {self.get_place(ctx.author.id)} der Rangliste gelandet.")
@commands.command(name="romantikboard")
async def cmd_romantikboard(self, ctx):
async def cmd_romantikboard(self, ctx, all=None):
place = 0
max = 10
max = 0 if all == "all" else 1
ready = False
message = "```fix\nDorfromantik Leaderboard\n\n"
message += " {:^3} | {:^37} | {:^9}\n".format("#", "Name", "Punkte")
......@@ -45,7 +45,7 @@ class Leaderboard(commands.Cog):
member = await ctx.guild.fetch_member(key)
place += 1
if place > max:
if 0 < max < place:
if ready:
break
elif str(ctx.author.id) != key:
......@@ -65,4 +65,4 @@ class Leaderboard(commands.Cog):
for key, value in sorted(self.highscores.items(), key=lambda item: item[1], reverse=True):
place += 1
if key == str(id):
return place
\ No newline at end of file
return place
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment