Skip to content

Commit

Permalink
shaodwing
Browse files Browse the repository at this point in the history
  • Loading branch information
mralext20 committed Jul 15, 2023
1 parent 0dd9018 commit 33c7c3d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions alexBot/cogs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ async def cog_unload(self):
@app_commands.command()
async def roll(self, interaction: discord.Interaction, dice: str):
"""Rolls a dice in NdN format."""
rolls: List[Roll] = []
roll_results: List[Roll] = []
for rollset in dice.split(" "):
try:
rolls, limit = map(int, dice.split("d"))
except Exception:
return await interaction.response.send_message("Format has to be in `WdX YdZ`...!", ephemeral=True)
rolls.append(Roll(f"{rolls}d{limit}", [random.randint(1, limit) for r in range(rolls)]))
return await interaction.response.send_message("Format has to be in `WdX YdZ`...!", ephemeral=True)
roll_results.append(Roll(f"{rolls}d{limit}", [random.randint(1,limit) for r in range(rolls)]))

result = ", ".join([str(r) for r in rolls])
result = "\n".join([str(r) for r in roll_results])
raw_results = []
for roll in rolls:
for roll in roll_results:
raw_results.append(r for r in roll.rolls)

result += f"\n\nTotal: {sum(raw_results)}"
Expand Down

0 comments on commit 33c7c3d

Please sign in to comment.