From c9069a522118bf8b8cbe5e42988b2ef7bdd0f978 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 10 Feb 2019 14:40:20 +0100 Subject: [PATCH] Move /roll to strings --- strings.py | 8 ++++++++ telegrambot.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/strings.py b/strings.py index fcc15555..d1e52bf8 100644 --- a/strings.py +++ b/strings.py @@ -126,6 +126,14 @@ class MATCHMAKING: MATCH_CLOSED = "⚠ Il matchmaking per questa partita è terminato!" +# Dice roller +class ROLL: + SUCCESS = "🎲 {result}" + + class ERRORS: + INVALID_SYNTAX = "⚠ Il tiro dei dadi è fallito. Controlla la sintassi!" + + # Ship creator class SHIP: RESULT = "💕 {one} + {two} = {result}" diff --git a/telegrambot.py b/telegrambot.py index 9526e930..5c578f00 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -698,9 +698,9 @@ def cmd_roll(bot: telegram.Bot, update: telegram.Update): try: result = dice.roll(f"{dice_string}t") except dice.DiceBaseException: - bot.send_message(update.message.chat.id, "⚠ Il tiro dei dadi è fallito. Controlla la sintassi!") + reply(bot, update, strings.ROLL.ERRORS.INVALID_SYNTAX) return - bot.send_message(update.message.chat.id, f"🎲 {result}") + reply(bot, update, strings.ROLL.SUCCESS, result=result) @command