From 520fff44028a9a61db148ff8d79445ea62c05a41 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 6 Apr 2017 22:48:45 +0200 Subject: [PATCH] Allow tweeting images without caption --- bottools/methods.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bottools/methods.py b/bottools/methods.py index 04bb671..e73d174 100644 --- a/bottools/methods.py +++ b/bottools/methods.py @@ -59,16 +59,19 @@ def captionHelper(bot, update): else: args = update.message.caption.split() - if args[0].startswith("/"): - try: - feature = commands[args[0][1:]] + try: + if args[0].startswith("/"): try: - feature(bot, update, args[1:]) + feature = commands[args[0][1:]] + try: + feature(bot, update, args[1:]) + except: + feature(bot, update) except: - feature(bot, update) - except: - update.message.reply_text(bottools.strings.unknownCommand) - else: + update.message.reply_text(bottools.strings.unknownCommand) + else: + raise ValueError() + except: explicitTweet(bot, update, args) def mentionHelper(bot, update):