From ef454338ae7bef36c53e91a20750b1e460d79242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Thu, 24 Oct 2019 14:07:50 +0200 Subject: [PATCH] add /queue command --- delojza.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/delojza.py b/delojza.py index 2e89082..d782886 100755 --- a/delojza.py +++ b/delojza.py @@ -111,6 +111,7 @@ class DelojzaBot: dp.add_handler(CommandHandler("delete", self.tg_delete)) dp.add_handler(CommandHandler("protect", self.tg_protect)) dp.add_handler(CommandHandler("version", self.tg_version)) + dp.add_handler(CommandHandler("queue", self.tg_queue)) dp.add_handler(MessageHandler(None, self.tg_handle)) self.acoustid_key = acoustid_key @@ -703,6 +704,13 @@ class DelojzaBot: else: update.message.reply_text((self.markov.make_sentence() if self.markov and random() > .7 else "") + "???") + def tg_queue(self, _, update): + if self.tumblr_client: + blog_info = self.tumblr_client.blog_info(self.tumblr_name) + update.message.reply_text("Currently queued tumblr posts: " + str(blog_info['blog'].get('queue', "???"))) + else: + update.message.reply_text((self.markov.make_sentence() if self.markov and random() > .7 else "") + "???") + # noinspection PyMethodMayBeStatic def tg_version(self, _, update): self._log_msg(update)