Fix media handler and timeline handler

This commit is contained in:
Klaus-Uwe Mitterer 2017-03-21 22:08:21 +01:00
parent 59b4bcd548
commit 699ad8b32b

View file

@ -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))