1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

This doesn't either

This commit is contained in:
Steffo 2018-09-11 02:11:56 +02:00
parent 46c1522415
commit 5f60c2eb17
2 changed files with 7 additions and 2 deletions

View file

@ -12,4 +12,5 @@ bcrypt
markdown2
pygments
markovify
praw
praw
dice

View file

@ -506,10 +506,14 @@ def cmd_markov(bot: Bot, update: Update):
def cmd_roll(bot: Bot, update: Update):
dice_string = update.message.text.split(" ", 1)[1]
try:
result = dice.utilities.verbose_print(dice_string)
result = dice.roll(dice_string)
except dice.DiceBaseException:
bot.send_message(update.message.chat.id, "⚠ Il tiro dei dadi è fallito. Controlla la sintassi!")
return
if isinstance(result, list):
result = "\n".join([str(r) for r in result])
elif isinstance(result, int):
result = str(result)
bot.send_message(update.message.chat.id, f"🎲 {result}")