This is a simple Reddit bot that gets a random post from the top posts of the week from Reddit and posts it to Discord.
You can send a message with the red
prefix in Discord followed by any subreddit name that you would like to see a post from. For example, this will get you a random post from the r/Python subreddit:
red python
To set up this bot, you will need:
- Discord Token: See the guide for this here.
- Reddit Personal Use Script and Reddit Secret: You can create one here.
- Reddit Refresh Token and Reddit Access Token: You can create one using this.
- Reddit Username
Then save all these in a .env
file in this format:
DISCORD_TOKEN=
REDDIT_PERSONAL_USE_SCRIPT=
REDDIT_SECRET=
REDDIT_REFRESH_TOKEN=
REDDIT_ACCESS_TOKEN=
REDDIT_USERNAME=
Then run the index.js
:
node index.js
NOTE: Since this uses discord.js v13 you will need Node v16.6+ to run this.