voidstar0 / blm-instagram-bot

Inform users clogging the #BlackLivesMatter tag on IG with solid images
135 stars 31 forks source link

Checks post to see if bot has commented already #4

Closed kraj011 closed 4 years ago

kraj011 commented 4 years ago

You can most likely make this better by caching, but I think this solution would work for the time being. If the bot is ready to comment on a post, it first iterates through the post's comments (if any) and checks if a bot has already commented on it with the message. I decided that instead of checking by User ID (since there may be multiple people / accounts running this bot), I check if a portion of relevant text is in the comment. If it is, no need to re-comment. If not, the bot knows to go ahead and comment. Overall, this feature will prevent bots spamming a user's post telling them to repost with the new hashtag! One comment is enough :D