1

So, I have been attempting to create a bot much like "TweetShift" on a smaller scale for a single server, where the bot listens to a stream of tweets from a single user, with the rules:

{"value": "from:"+process.env.TWITTER_USER_NAME+" -is:retweet -is:quote -is:reply"}

and have been attempting to make it listen forever. I did this originally in twitter-v2 with the help of a guide but it has been giving me "Too Many Requests" errors from twitter's side, even after deleting the bot/project in Twitter Dev Portal and trying again (I set a timeout_ms to 60000 which I thought was correct?).

I realise twitter-api-v2 is the much more used library now (twit didn't work for me) and is a much better option but I am really struggling with understanding how to implement the following as a repeated stream with rules:

for await (const { data } of stream) {
  // post to channel on discord about tweet
  const url = // some url grabbing code from data here
  const channel = await client.channels.fetch(process.env.TWITTER_DISCORD_CHANNEL_ID)
  channel.send(`<@&${process.env.TWITTER_ROLE_ID}> I just tweeted: \n`+url)
}

Can anyone give me a point in the right direction as to where to start with this? I've not been programming for long so I am trying my best :-) thank you guys

cronch
  • 11
  • 1

0 Answers0