From 6709364df6a39d0ced97c1d6cb1ff7ed630838e8 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 22 Feb 2019 02:05:49 +0100 Subject: [PATCH] Bugfix per /pug --- strings.py | 3 +++ telegrambot.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/strings.py b/strings.py index f7e2993c..ebae06f7 100644 --- a/strings.py +++ b/strings.py @@ -187,6 +187,9 @@ class MATCHMAKING: class PUG: HERE_HAVE_A_PUG = '🐶 Ecco, tieni un carlino.' + class ERRORS: + PRIVATE_CHAT_ONLY = "⚠ Foto di carlini possono essere inviate esclusivamente in chat privata, in seguito al Disegno di Legge Intergalattico n. 5116." + # Dice roller class ROLL: diff --git a/telegrambot.py b/telegrambot.py index 76a189f4..f3720490 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -819,6 +819,9 @@ def cmd_emojify(bot: telegram.Bot, update: telegram.Update): @command def cmd_pug(bot: telegram.Bot, update: telegram.Update): + if update.effective_chat.type != telegram.Chat.PRIVATE: + reply(bot, update, strings.PUG.ERRORS.PRIVATE_CHAT_ONLY) + return j = requests.get("https://dog.ceo/api/breed/pug/images/random").json() reply(bot, update, strings.PUG.HERE_HAVE_A_PUG, disable_web_page_preview=False, image_url=j["message"])