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): ...@@ -22,20 +22,20 @@ class Leaderboard(commands.Cog):
async def cmd_highscore(self, ctx, score: int): async def cmd_highscore(self, ctx, score: int):
""" Add highscore for Dorfromantik leaderboard """ """ Add highscore for Dorfromantik leaderboard """
if highscore := self.highscores.get(str(ctx.author.id)): if score > 50:
self.highscores[str(ctx.author.id)] = max(highscore, score) if highscore := self.highscores.get(str(ctx.author.id)):
else: self.highscores[str(ctx.author.id)] = max(highscore, score)
self.highscores[str(ctx.author.id)] = score else:
self.save() 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.")
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") @commands.command(name="romantikboard")
async def cmd_romantikboard(self, ctx): async def cmd_romantikboard(self, ctx, all=None):
place = 0 place = 0
max = 10 max = 0 if all == "all" else 1
ready = False ready = False
message = "```fix\nDorfromantik Leaderboard\n\n" message = "```fix\nDorfromantik Leaderboard\n\n"
message += " {:^3} | {:^37} | {:^9}\n".format("#", "Name", "Punkte") message += " {:^3} | {:^37} | {:^9}\n".format("#", "Name", "Punkte")
...@@ -45,7 +45,7 @@ class Leaderboard(commands.Cog): ...@@ -45,7 +45,7 @@ class Leaderboard(commands.Cog):
member = await ctx.guild.fetch_member(key) member = await ctx.guild.fetch_member(key)
place += 1 place += 1
if place > max: if 0 < max < place:
if ready: if ready:
break break
elif str(ctx.author.id) != key: elif str(ctx.author.id) != key:
...@@ -65,4 +65,4 @@ class Leaderboard(commands.Cog): ...@@ -65,4 +65,4 @@ class Leaderboard(commands.Cog):
for key, value in sorted(self.highscores.items(), key=lambda item: item[1], reverse=True): for key, value in sorted(self.highscores.items(), key=lambda item: item[1], reverse=True):
place += 1 place += 1
if key == str(id): if key == str(id):
return place return place
\ No newline at end of file
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