Merge pull request #39 from robbyblum/master

issue #35 fix hopefully ("can't display 0 star player" bug)
This commit is contained in:
Sakimori 2020-12-26 20:27:27 -05:00 committed by GitHub
commit 6e8a54cead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,6 +137,7 @@ async def on_message(msg):
if innings < 2: if innings < 2:
await msg.channel.send("Anything less than 2 innings isn't even an outing. Try again.") await msg.channel.send("Anything less than 2 innings isn't even an outing. Try again.")
return return
elif innings > 30 and msg.author.id not in config()["owners"]: elif innings > 30 and msg.author.id not in config()["owners"]:
await msg.channel.send("Y'all can't behave, so we've limited games to 30 innings. Ask xvi to start it with more if you really want to.") await msg.channel.send("Y'all can't behave, so we've limited games to 30 innings. Ask xvi to start it with more if you really want to.")
@ -147,7 +148,7 @@ async def on_message(msg):
elif command.startswith("setupgame"): elif command.startswith("setupgame"):
if len(gamesarray) > 45: if len(gamesarray) > 45:
await msg.channel.send("We're running 45 games and we doubt Discord will be happy with any more. These edit requests don't come cheap.") await msg.channel.send("We're running 45 games and we doubt Discord will be happy with any more. These edit requests don't come cheap."
return return
elif config()["game_freeze"]: elif config()["game_freeze"]:
await msg.channel.send("Patch incoming. We're not allowing new games right now.") await msg.channel.send("Patch incoming. We're not allowing new games right now.")
@ -518,15 +519,13 @@ def build_star_embed(player_json):
for key in starkeys.keys(): for key in starkeys.keys():
embedstring = "" embedstring = ""
starstring = str(player_json[key]) starstring = str(player_json[key])
if ".5" in starstring:
starnum = int(starstring[0]) starnum = int(starstring[0])
addhalf = True addhalf = ".5" in starstring
else:
starnum = int(player_json[key])
addhalf = False
embedstring += "" * starnum embedstring += "" * starnum
if addhalf: if addhalf:
embedstring += "" embedstring += ""
elif starnum == 0: # why check addhalf twice, amirite
embedstring += "⚪️"
embed.add_field(name=starkeys[key], value=embedstring, inline=False) embed.add_field(name=starkeys[key], value=embedstring, inline=False)
return embed return embed