adding title
This commit is contained in:
parent
999d7e27b7
commit
1916ac93e7
13
bot.js
13
bot.js
@ -46,6 +46,7 @@ const download_image = async (url, image_path) => {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
async function getLastPostDate() {
|
async function getLastPostDate() {
|
||||||
|
console.log("Getting Last Post Date: getLastPostDate()");
|
||||||
let timeline = await M.get(
|
let timeline = await M.get(
|
||||||
`accounts/${process.env.MASTODON_ACCOUNT_ID}/statuses`,
|
`accounts/${process.env.MASTODON_ACCOUNT_ID}/statuses`,
|
||||||
{}
|
{}
|
||||||
@ -87,18 +88,22 @@ async function processFeed(feed, postDate) {
|
|||||||
);
|
);
|
||||||
await download_image(metadata.image, path);
|
await download_image(metadata.image, path);
|
||||||
|
|
||||||
|
return postFeedItem(path, item);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function postFeedItem(path, item) {
|
||||||
let mediaup = await M.post("media", {
|
let mediaup = await M.post("media", {
|
||||||
file: fs.createReadStream(path),
|
file: fs.createReadStream(path),
|
||||||
});
|
});
|
||||||
|
|
||||||
return M.post("statuses", {
|
return M.post("statuses", {
|
||||||
status: `${
|
status: `${item.title}\n\n${
|
||||||
item.contentSnippet ? item.contentSnippet : item.title
|
item.contentSnippet ? "\n\n" + item.contentSnippet : ""
|
||||||
}\n\n#NeoVibe #${process.env.POST_HASHTAG}\n\n${item.link}`,
|
}\n\n#NeoVibe #${process.env.POST_HASHTAG}\n\n${item.link}`,
|
||||||
media_ids: [mediaup.data.id],
|
media_ids: [mediaup.data.id],
|
||||||
});
|
});
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runBot() {
|
async function runBot() {
|
||||||
|
Loading…
Reference in New Issue
Block a user