Closed spences10 closed 1 year ago
I would like to take this one
Cool, you may want to split the blacklist into a comma separated line, like:
BLACKLIST_USERNAMES=_100DaysOfCode,heroes_bot
Thanks @danielfsousa π
How are you getting on with this @danielfsousa?
Hey @danielfsousa looks like there's been nothing committed to your fork so I'll open this up for other people interested in doing this.
That's ok @spences10. Sorry for not replying sooner
Up for grabs now @toxxn π
@spences10
I went ahead and tried to use the #100DaysOfCode Twitter Bot since it seemed like it had the blacklist feature implemented already, however I'm stuck lol, that version of the bot won't deploy and when I just "npm start", it loops but doesn't post.... Maybe ill try your blacklist here haha.
Would I adjust retweet.js and replace this code or would I create a handleretweet.js then adjust retweet.js to include and use the handleretweet.js? Would I need to add a db.js under helpers?
Hey, just seen this, I don't seem to get notified about these. I answered your question about why the bot won't deploy there, I hope you understand π let me know if you need anything clarifying.
So in its simplest form the blacklist is if (blacklist.indexOf(event.screen_name) > -1)
where blacklist
is the usernames added from the config.
Most of it is detailed in the original post, I'm on mobile now so can't be any more specific at this time.
Add a user blacklist to the Twitterbot bootstrap π΄
I have similar functionality in another bot where the blacklist is configured in a
.env
file and you can use a comma-separated list in the.env
file, like so:Then use something along the same lines as what is here:
The code for this is located here: https://github.com/spences10/twitter-bot-twit/blob/ee6d1e4bef3e37af84c1eccec2a12337513e165a/src/helpers/dbHandleRetweet.js#L1-L33
Ideally, this would be checked before (re)tweeting so it should go somewhere like @nikkilr88's last commit, here: 9c9b83b09bb55f77660c868b7d52ae3bff31b20b