From cd186631d0dab3af7cdaa46f341e0633f458b7d8 Mon Sep 17 00:00:00 2001 From: "Michael (GP)" Date: Tue, 13 Dec 2022 13:09:48 -0500 Subject: [PATCH] reverting to older fix --- bot.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/bot.js b/bot.js index 08ac21d..27713a7 100644 --- a/bot.js +++ b/bot.js @@ -68,22 +68,15 @@ async function postFeed() { ); await download_image(metadata.image, path); - let rstream = fs.createReadStream(path); - rstream.on("open", async (fd) => { - let mediaup = await M.post("media", { - file: rstream, - }); - - await M.post("statuses", { - status: `${item.title}\n\n#NeoVibe #${process.env.POST_HASHTAG}\n\n${item.link}`, - media_ids: [mediaup.data.id], - }); - - return true; + let mediaup = await M.post("media", { + file: fs.createReadStream(path), }); - rstream.on("error", (err) => { - // error on the stream + + await M.post("statuses", { + status: `${item.title}\n\n#NeoVibe #${process.env.POST_HASHTAG}\n\n${item.link}`, + media_ids: [mediaup.data.id], }); + return true; } return true;