Skip to content

Commit

Permalink
feat: try catch like comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dhohirpradana committed Mar 15, 2023
1 parent 31c5f0b commit 4234a8b
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,24 +321,32 @@ async function generateImage(text: string) {

if (item.user.username == "dhohirpradana") return console.log("❌ Skip own feed");

// like a timeline feed
await ig.media.like({
mediaId: item.id,
moduleInfo: {
module_name: "profile",
user_id: item.user.pk,
username: item.user.username,
},
d: 0,
});
try {
// like a timeline feed
await ig.media.like({
mediaId: item.id,
moduleInfo: {
module_name: "profile",
user_id: item.user.pk,
username: item.user.username,
},
d: 0,
});
} catch (error) {
console.log("❌ Error like timeline feed", error);
}

// comment a timeline feed
const comment = await getQuotes1();
try {
// comment a timeline feed
const comment = await getQuotes1();

await ig.media.comment({
mediaId: item.id,
text: comment,
});
await ig.media.comment({
mediaId: item.id,
text: comment,
});
} catch (error) {
console.log("❌ Error comment timeline feed", error);
}

// delay for random between 5 and 15 seconds
await bluebird.delay(Math.floor(Math.random() * 10 + 5) * 1000);
Expand Down

0 comments on commit 4234a8b

Please sign in to comment.