with tempfile.TemporaryDirectory() as tmpdirname:
tempfilenames = []
for mmfile in post["metadata"]["files"]:
- if mmfile["mime_type"] == "image/webp":
+ if mmfile["mime_type"] in ["image/webp", "invalid-image/webp"]:
res = self.bot.api.get_file(mmfile["id"])
with open(tmpdirname+"/"+mmfile["id"]+".webp", 'wb') as tmpfile:
tmpfile.write(res.content)
root_id = post["id"]
if post["root_id"] != "":
root_id = post["root_id"]
- self.bot.api.create_post(post['channel_id'], "Let me convert that for you", props={"from_webhook":"true"}, filepaths=tempfilenames, root_id=root_id)
+ self.bot.api.create_post(post['channel_id'], "Let me convert that webp for you", props={"from_webhook":"true"}, filepaths=tempfilenames, root_id=root_id)
return True