added GIF support
This commit is contained in:
parent
d1553380be
commit
5137655a47
1 changed files with 6 additions and 2 deletions
|
@ -27,8 +27,12 @@ def telegram_bot_post(data):
|
|||
text+="\n\n".join(data["descriptions"])
|
||||
text=text.replace("@","\uFF20")
|
||||
if len(data["images"])==1:
|
||||
url="https://api.telegram.org/bot"+token+"/sendPhoto"
|
||||
response=requests.post(url, data={'chat_id': chat, 'caption': text, 'caption_entities':json.dumps(entities), "reply_markup":json.dumps({"inline_keyboard": [[{"text": "Sauce...", "url": data["link"]}]]})}, files={'photo': open(os.path.join("tumblrbot",data["images"][0]),"rb")})
|
||||
if data["images"][0].endswith(".gif"):
|
||||
url="https://api.telegram.org/bot"+token+"/sendAnimation"
|
||||
response=requests.post(url, data={'chat_id': chat, 'caption': text, 'caption_entities':json.dumps(entities), "reply_markup":json.dumps({"inline_keyboard": [[{"text": "Sauce...", "url": data["link"]}]]})}, files={'animation': open(os.path.join("tumblrbot",data["images"][0]),"rb")})
|
||||
else:
|
||||
url="https://api.telegram.org/bot"+token+"/sendPhoto"
|
||||
response=requests.post(url, data={'chat_id': chat, 'caption': text, 'caption_entities':json.dumps(entities), "reply_markup":json.dumps({"inline_keyboard": [[{"text": "Sauce...", "url": data["link"]}]]})}, files={'photo': open(os.path.join("tumblrbot",data["images"][0]),"rb")})
|
||||
else:
|
||||
text+="\n\nSauce: "+data["link"]
|
||||
files={}
|
||||
|
|
Loading…
Reference in a new issue