You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I tried to retrieve the last tweet of sb with your API but it returns me an error like I don't have enough roit yet I have a dev account on Twitter. Can you help me please, thx
const{ TwitterApi }=require('twitter-api-v2');functionNotificationsTwitter(client){consttwitterClient=newTwitterApi('API_CODE');constreadOnlyClient=twitterClient.readOnly;// Play with the built in methodsconstuser=readOnlyClient.v2.userByUsername('USERNAME').then((user)=>{lettweetChannelId='CHANNEL_ID';letlastTweetId='';console.log('NotifTwitter')console.log(user)functioncheckNewTweets(){twitterClient.get('statuses/user_timeline.json',{screen_name: 'USERNAME',count: 1},function(error,tweets,response){//console.log(tweets, response)if(!error){constlatestTweet=tweets[0];if(latestTweet.id_str!==lastTweetId){consttweetUrl=`https://twitter.com/${latestTweet.user.screen_name}/status/${latestTweet.id_str}`;consttweetChannel=client.channels.cache.get(tweetChannelId);tweetChannel.send(tweetUrl);lastTweetId=latestTweet.id_str;}}});}checkNewTweets();}).catch((error)=>{console.error(error);});}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I tried to retrieve the last tweet of sb with your API but it returns me an error like I don't have enough roit yet I have a dev account on Twitter. Can you help me please, thx
Beta Was this translation helpful? Give feedback.
All reactions