tweet-random-question
This simple script tweets a random question using Node.js and the twit Twitter API library for Node module.
##To Use
This is based on Christian Paulsen's instructions to build a Twitter bot.
- Install Node.js and create a Twitter account for the bot.
- Register your bot as an application with Twitter.
- Install the twit module. Follow the instructions at the link to connect your Twitter account to twit.
- Create a text file called
questions.txt
, using one line per question. I've included asamplequestions.txt
file with a few seed questions.
##What It Does
The script randomquestion.js
will select a random line from questions.txt
and post it to the Twitter account you created. It also logs the line selected in log.txt
.
##Features I'd like to add
- Add attempt to retry posting lines that are too line.
- Search log to prevent re-posting lines that have already been posted.
- Function to clear log file at regular intervals.