draftbit / twitter-lite

A tiny, full-featured, flexible client / server library for the Twitter API
https://npm.im/twitter-lite
MIT License
794 stars 96 forks source link

Only allow code to post tweets from the account defined in the "follow" parameter. #183

Open Timtendo12 opened 2 years ago

Timtendo12 commented 2 years ago
 const parameters = {
      follow: `${config.TWITTER_USER_ID}`,  // The ID of the user it should follow, In this bots case its @FarCryGame
    };

    const stream = Tclient.stream("statuses/filter", parameters)
      .on("start", response => console.log("Starts checking for tweets"))
        .on("data", tweet => {
             const TwitterEmbed = new MessageEmbed()
               .setColor("ORANGE")
               .setTitle(`${tweet.user.name}`)
               .setDescription(`${tweet.text}`)
               .setURL(`https://www.twitter.com/Timtendo12/Status/` + `${tweet.id}`)
               .setAuthor(`${tweet.user.name}, posted a new tweet!`, 'https://pbs.twimg.com/profile_images/1286368132487995392/p-CyXKSj_400x400.jpg', 'https://www.twitter.com/Timtendo12');
            client.channels.cache.get(`${config.TWITTER_CHANNEL_ID}`).send({embeds: [TwitterEmbed]})
        })

Currently I have this code, It works. However, when someone else retweets, shares etc etc any tweet from the one defined in the following parameters it also outputs them retweeting them. How do you filter this so it will only output when the defined follower posts a tweet?