A Reddit bot to make scheduled subreddit posts, implemented in Ruby.
- Clone the bot onto a server. If you don't have one, I recommend an Ubuntu server on DigitalOcean ($5/mo). Or, if you message me on Reddit (/u/schneidmaster) and ask nicely I might let you use mine.
- Install ruby and bundler:
sudo apt-get install ruby bundler - Run
bundleto install the required gems. - Copy
.env.exampleto.envand fill it in with your bot's username, password, and subreddit to post in. - Copy
schedule.example.rbtoschedule.rband fill it in with each scheduled post you'd like the bot to make. - For each post, create a corresponding markdown file in the
posts/folder with the post text. For example, if you create a Saturday post likemake :post, title: 'Saturday Thread', name: 'saturday', you would createposts/saturday.mdwith the post text. You can use Reddit's flavor of markdown in post content. - Run
bundle exec whenever -wto write your schedule to your server's cron file. (Repeat this command if you ever update the post schedule.)
To make it easier to deploy changes, RedditPoster includes a Capistrano deployment recipe. This lets you edit your post messages and schedule on your computer and then automatically deploy, bundle, and update the cron file. To use Capistrano:
- Clone the bot onto your computer and run
bundleto install dependencies. - Copy
production.example.rbtoproduction.rband fill in your server's IP address, SSH user, and the path where you want RedditPoster to live on your server. - Make any updates to your post texts and schedule (see above), then run
cap production deployto deploy the changes.
Cron will by default use your server's timezone to determine when to run tasks. You can set this with sudo dpkg-reconfigure tzdata; also, remember to run sudo service cron restart after altering the timezone.
- Fork it ( https://github.com/schneidmaster/RedditPoster/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request