From 699ad8b32ba8f411cf300a4ab50f4b87c76efa52 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Tue, 21 Mar 2017 22:08:21 +0100 Subject: [PATCH] Fix media handler and timeline handler --- telegrambot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telegrambot.py b/telegrambot.py index a89f0b4..8b0f69b 100755 --- a/telegrambot.py +++ b/telegrambot.py @@ -116,7 +116,7 @@ def explicitTweet(bot, update, args, reply = None): two = getTwo(update.message) if update.message.photo or update.message.document or update.message.video or update.message.sticker: - fid = update.message.document.file_id if update.message.document.file_id else update.message.sticker.file_id if update.message.sticker else update.message.video.file_id if update.message.video else update.message.photo[-1].file_id + fid = update.message.document.file_id if update.message.document else update.message.sticker.file_id if update.message.sticker else update.message.video.file_id if update.message.video else update.message.photo[-1].file_id path = bot.getFile(fid).file_path media = urllib.request.urlopen(path) mobj = io.BytesIO(media.read()) @@ -238,7 +238,7 @@ if __name__ == "__main__": updater.dispatcher.add_handler(telegram.ext.CommandHandler("retweet", retweet, pass_args=True)) updater.dispatcher.add_handler(telegram.ext.CommandHandler("start", start)) updater.dispatcher.add_handler(telegram.ext.CommandHandler("test", test, pass_args=True)) - updater.dispatcher.add_handler(telegram.ext.CommandHandler("timeline", timeline)) + updater.dispatcher.add_handler(telegram.ext.CommandHandler("timeline", timeline, pass_args=True)) updater.dispatcher.add_handler(telegram.ext.CommandHandler("toggletweet", toggleTweet)) updater.dispatcher.add_handler(telegram.ext.CommandHandler("tweet", explicitTweet, pass_args=True)) updater.dispatcher.add_handler(telegram.ext.CommandHandler("unauth", unauth))