README
loljs-bot is a Reddit bot to automate the "lol, JavaScript" style posts in /r/programmerhumor. On default settings, it takes a random post from /r/loljs every day and reposts it without modifications, crediting the original poster in a comment.
Running the bot yourself
First, download the source code
$ git clone https://github.com/DeeSnow97/loljs-bot
Then configure the environment variables. You can set them through usual ways or use a .env file. If you choose the latter, it should look something like this:
# Reddit credentials
REDDIT_CLIENT_ID=seriousbot007
REDDIT_CLIENT_SECRET=iLikePaamayimNekudotayim
REDDIT_USERNAME=loljs-bot
REDDIT_PASSWORD=[object Object] # just kidding, it cannot contain spaces
# Uncomment this line to change the posting interval
# POST_INTERVAL=86400000
Then just run the bot however long you want to
$ node loljs-bot
Advanced Usage
Currently, loljs-bot exposes one function on the public interface:
repost(source = 'loljs', target = 'programmerhumor')
Takes a random post from the source subreddit and reposts it in the target.
Usage:
const {repost} = require('loljs-bot') repost('lolphp', 'programmerhumor') // the same thing as the original bot, but with lolphp
However, if you like hacking, you can do stuff like require('loljs-bot/randompost')
to access intermediate states (randompost for example loads and prepares a random post, but doesn't repost it).
Message of the Day
loljs-bot has a (severely lacking) set of "message of the day" strings in messages.yaml. Feel free to contribute to that, but please make separate pull requests for each line in case moderation happens in the future.
Contributing Guidelines
The brief set of rules in order of precedence:
- don't be a d_ck to each other
- use JavaScript Standard Style
Otherwise feel free to follow the license and just do what the fuck you want to.