1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +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

@ -13,3 +13,4 @@ markdown2
pygments pygments
markovify markovify
praw praw
dice

View file

@ -506,10 +506,14 @@ def cmd_markov(bot: Bot, update: Update):
def cmd_roll(bot: Bot, update: Update): def cmd_roll(bot: Bot, update: Update):
dice_string = update.message.text.split(" ", 1)[1] dice_string = update.message.text.split(" ", 1)[1]
try: try:
result = dice.utilities.verbose_print(dice_string) result = dice.roll(dice_string)
except dice.DiceBaseException: except dice.DiceBaseException:
bot.send_message(update.message.chat.id, "⚠ Il tiro dei dadi è fallito. Controlla la sintassi!") bot.send_message(update.message.chat.id, "⚠ Il tiro dei dadi è fallito. Controlla la sintassi!")
return 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}") bot.send_message(update.message.chat.id, f"🎲 {result}")