Overall fixes to unexpected/unwanted behavior

This commit is contained in:
2023-05-08 19:20:51 +02:00
parent b60a78e75a
commit 8dc46a6319
4 changed files with 53 additions and 31 deletions
+10 -5
View File
@@ -97,8 +97,11 @@ class SlashLeaderboard(commands.Cog):
for i in servers:
if(snippet.lower() in i.lower()):
server = i
break
if(snippet.lower()== i.lower()):
server = i
break
else:
server = i
return server
@@ -128,10 +131,12 @@ class SlashLeaderboard(commands.Cog):
checked = stats[str(board)]
if(hardfilter):
if(board.lower() == "kd"):
if (stats['deaths'] == 0):
deaths = 1
if(weaponid != ""):
deaths = stats['deaths_while_equipped']
else:
deaths = stats['deaths']
if(deaths == 0):
deaths = deaths + 1
checked = round(stats["kills"] / deaths, 2)
if(board.lower() == "avgd"):
if(stats["kills"] == 0):
@@ -165,7 +170,7 @@ class SlashLeaderboard(commands.Cog):
stat = str("{:0.2f}".format(j))
if(easyfilter):
stat = str(j)
botmessage = botmessage + str(f"{str(counter):<2}"+ " - " + f"{i :<15}" + " : "+ f"{stat:<8}" + "\n")
botmessage = botmessage + str(f"{str(counter):<2}"+ " - " + f"{i :<20}" + " : "+ f"{stat:<8}" + "\n")
counter= counter+1
return botmessage
+8 -3
View File
@@ -129,8 +129,11 @@ class SlashStats(commands.Cog):
for i in servers:
if(snippet.lower() in i.lower()):
server = i
break
if(snippet.lower()== i.lower()):
server = i
break
else:
server = i
return server
@@ -151,7 +154,9 @@ class SlashStats(commands.Cog):
deaths=killstats['deaths_while_equipped']
if(deaths == 0):
deaths = 1;
botmessage += str("Deaths : " + str(killstats['deaths_while_equipped'])) + '\n' + str("Weapon : " + weaponname) + '\n' + str(str("weapon KD : " + str("{:0.2f}".format(killstats['kills']/deaths))))
botmessage += str(str("Deaths : " + str(killstats['deaths_while_equipped'])) + '\n' + str("Weapon : " + weaponname) +
'\n' + str(str("weapon KD : " + str("{:0.2f}".format(killstats['kills']/deaths)))) + '\n' + str("Deaths to : " + str(killstats['deaths'])))
else:
deaths=killstats['deaths']
if(deaths == 0):