Convert image to JPEG and upload properly

This commit is contained in:
Jack Matthews 2023-07-12 16:15:26 -04:00
parent c17c7545b5
commit bccf0f63e3
No known key found for this signature in database

View File

@ -1,3 +1,4 @@
import sharp from "sharp";
import threads from "threads-api";
import Client from "./Client.mjs";
@ -17,9 +18,11 @@ export default class ThreadsClient extends Client {
}
async send(status, generator) {
let jpeg = await sharp(status.media[0].file).jpeg().toBuffer();
await this.#api.publish({
text: status.status,
image: status.media[0].file,
image: { type: "image/jpeg", data: jpeg },
});
}
}