add a TUMBLR_NOW special hashtag for direct tumblr posting

This commit is contained in:
Tomáš Mládek 2019-05-01 10:52:14 +02:00 committed by Tomáš Mládek
parent ce28caa1db
commit 0e4ba13166

View file

@ -14,6 +14,7 @@ import markovify
import mutagen.id3 import mutagen.id3
import pytumblr import pytumblr
import requests import requests
import telegram
import youtube_dl import youtube_dl
from telegram import MessageEntity from telegram import MessageEntity
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
@ -185,6 +186,11 @@ class DelojzaBot:
message.reply_text('(btw, queueing to tumblr)') message.reply_text('(btw, queueing to tumblr)')
for filename in filenames: for filename in filenames:
self.client.create_photo('kunsaxan', state="queue", data=filename) self.client.create_photo('kunsaxan', state="queue", data=filename)
elif hashtag == 'TUMBLR_NOW' and self.client:
message.reply_text('(btw, ***FIRING TO TUMBLR RIGHT AWAY***)',
parse_mode=telegram.ParseMode.MARKDOWN)
for filename in filenames:
self.client.create_photo('kunsaxan', state="published", data=filename)
return filenames return filenames
except: except:
_, exc_value, __ = sys.exc_info() _, exc_value, __ = sys.exc_info()