FIX: roulette now updates the leaderboard with a try statement

ipm
Kamal Curi 2 years ago
parent 3a1f6832f8
commit 5351f8a99c

@ -5,7 +5,7 @@
█ ▄ █ ▄▄▄█ ▄▄▄█ ▄ ██ █▄▄▄█ ▄▄▄█ █ ▄ █ ▄▄▄█ ▄▄▄█ ▄ ██ █▄▄▄█ ▄▄▄█
█ █ █ █ █▄▄▄█ █▄▄▄█ █▄█ █ █ █▄▄▄ █ █ █ █ █▄▄▄█ █▄▄▄█ █▄█ █ █ █▄▄▄
█▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█ █▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█
Neeble version: 2023.10.09c Neeble version: 2023.10.09d
Help with the development of neeble-bot in Help with the development of neeble-bot in
https://brejela.club/gitea/neeble-club/neeble https://brejela.club/gitea/neeble-club/neeble
Thank you! Thank you!

@ -567,7 +567,8 @@ async def roulette(bot:object, *option:str) -> str:
spin = 0 spin = 0
if comlock['roulette'] == True: if comlock['roulette'] == True:
return await bot.send(bot.author.name + " has hit command lock") await bot.send(bot.author.name + " has hit command lock")
return 0
if 'lb' in option: if 'lb' in option:
with open(ROULETTE_LEADERBOARD, mode='r') as file: with open(ROULETTE_LEADERBOARD, mode='r') as file:
@ -596,9 +597,9 @@ async def roulette(bot:object, *option:str) -> str:
await bot.send(f"BANG! {bot.author.name} died.") await bot.send(f"BANG! {bot.author.name} died.")
russians[bot.author.name] = 0 russians[bot.author.name] = 0
for r in russians.keys(): for r in russians.keys():
if bot.author.name in roulette_leaderboard.keys(): try:
roulette_leaderboard[r] += russians[r] roulette_leaderboard[r] += russians[r]
else: except KeyError:
roulette_leaderboard[r] = russians[r] roulette_leaderboard[r] = russians[r]
with open(ROULETTE_LEADERBOARD, mode='w') as file: with open(ROULETTE_LEADERBOARD, mode='w') as file:
json.dump(roulette_leaderboard, file) json.dump(roulette_leaderboard, file)

Loading…
Cancel
Save