#๐Ÿ”’ Displaying Dice for a Discord Bot

13 messages ยท Page 1 of 1 (latest)

wanton horizon
#

As of late, I've been working on a Discord bot that includes functionality for rolling dice, and I want to display the results of all the dice rolls in an embed. For example, rolling 2d4 + d6 will display two images of four-sided dice and one image of a six-sided die. At the moment, the Discord bot supports d4, d6, d8, d10, d12, d20, and d100. Additionally, the maximum number of dice that can be rolled at once is fifteen.

Because I want to support my current variety of dice, does that mean that I need to make 160 images of dice to account for every outcome of an individual roll for all die sizes? What do you all think is the most efficient way to make embeds for my Discord bot that show the result of each dice roll as images?

crimson flintBOT
#

@wanton horizon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

foggy coral
#

I would say yes, you have to make the images

slow flax
#

i agree, pick the simple option when you can

foggy coral
#

You could easily generated them with some automation. For each die, select a shape, then for each possible number, write it inside the shape

slow flax
#

and making a few images is very simple

foggy coral
#

Something like (pseudocode)

for shape in dice:
   for n in range(dice.max()):
     Image = new_empty_image()
     image.draw(dice.shape())
     Image.write(str(n))
     Image.save(dice.name+str(n)+".png")
   
crimson flintBOT
#

Hey @foggy coral!

Please edit your message to use a code block

Add a py after the three backticks.

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
wanton horizon
wanton horizon
foggy coral
#

PIL would be more than enough

crimson flintBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.