I'm in the process of creating a Twitter Bot that tweets out a quote from a list every 8 hours through setInterval.I've set up https://zeit.co for the server. When I run the programme in the server, it tweets the first quote. However, it doesn't tweet anything else then moving forward, despite me setting setInterval (tweetIt) for every 8 hours.Complete beginner here working on first ever project so any advice would be greatly appreciated.tweetIt(); setInterval(tweetIt, 1000*60*60*8) function tweetIt() { const nextIndex = lastTweetIndex === quotes.length - 1 ? 0 : lastTweetIndex + 1; const status = quotes[nextIndex]; twitter.postTweet({ status }, errorCallback, data => { lastTweetIndex = nextIndex; console.log(`Just published: "${status}".`); }); }; app.listen(3000, function() { console.log('Naval quotes Twitter bot up and running!'); }); sendDM('Bot started!');
Submitted July 15, 2018 at 10:03AM by SocratesSeneca
No comments:
Post a Comment