Make dice show the individual rolls
This commit is contained in:
parent
7660c454db
commit
a8c48756d6
11
app/dice.py
11
app/dice.py
@ -1,27 +1,28 @@
|
|||||||
import discord
|
# import discord
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
def roll_logic(sides):
|
def roll_logic(sides):
|
||||||
return randint(1, sides)
|
return randint(1, sides)
|
||||||
|
|
||||||
def roll(number_of_die, sides):
|
def roll(number_of_die, sides):
|
||||||
results = sum(list(tuple(roll_logic(int(sides)) for _ in range(int(number_of_die)))))
|
results = list(tuple(roll_logic(int(sides)) for _ in range(int(number_of_die))))
|
||||||
|
|
||||||
# blue
|
# blue
|
||||||
embed_color = 3447003
|
embed_color = 3447003
|
||||||
if results == 1:
|
if sum(results) == 1:
|
||||||
# Red
|
# Red
|
||||||
embed_color = 15158332
|
embed_color = 15158332
|
||||||
if results >= 10:
|
if sum(results) >= 10:
|
||||||
# Green
|
# Green
|
||||||
embed_color = 3066993
|
embed_color = 3066993
|
||||||
if results >= 15:
|
if sum(results) >= 15:
|
||||||
# Gold
|
# Gold
|
||||||
embed_color = 15844367
|
embed_color = 15844367
|
||||||
|
|
||||||
embed = discord.Embed(description=None, color=embed_color, type="rich")
|
embed = discord.Embed(description=None, color=embed_color, type="rich")
|
||||||
embed.set_author(name="Rolling %s %s sided die" % (number_of_die, sides))
|
embed.set_author(name="Rolling %s %s sided die" % (number_of_die, sides))
|
||||||
embed.add_field(name="**Total**", value=":game_die: %s" % results)
|
embed.add_field(name="**Total**", value=":game_die: %s" % results)
|
||||||
|
embed.add_field(name="**Total**", value=sum(results))
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
def parse_message(message):
|
def parse_message(message):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user