Skip to content

Java Spring Boot Discord bot that fetch posts from reddit and post them in discord. Reddit API, Firebase Storage API, Discord API and PostgreSQL used in this project

License

Notifications You must be signed in to change notification settings

Glaxier0/discord-bot-reddit-java

Repository files navigation

Discord Bot for Reddit using Java

This is a versatile Discord bot primarily designed for Reddit, capable of fetching posts from Reddit and posting them in Discord channels.

Used APIs

Reddit API

Firebase Storage API

Firebase Storage allows direct embedding of Reddit videos in Discord. Alternatively, any video hosting site can be used.

Discord API - JDA Wrapper

Requirements for Bot Setup

Reddit

Create reddit personal use script here to obtain client_id and client_secret.

Obtain a Reddit refresh token following these instructions.

After getting reddit environments edit the application.yaml.

Firebase

Obtain the Firebase Storage ADMIN SDK KEY from here

From the Firebase console (your project > settings > users and permissions > service accounts), generate a private key and download it then add it to the project root.

Also from (settings > general) note your Project ID and append .appspot.com to end of it, it should be something like this.

your-project-id.appspot.com

Edit bucket name and file name in application.yaml.

Example yaml:

firebase:
  storage:
    bucket:
      name: your-project-id.appspot.com
  adminsdk:
    file:
      name: your-admin-sdk.json

Discord

Obtain the Discord API bot token from here.

Find the ID of your main/admin server (only admin commands can be used in this server).

Find the ID of your Discord user (this determines who the bot admin is).

How to find id of the server and user

First you need to turn on developer mode in the discord app.

User settings > under app settings > advanced > turn on developer mode.

Now by right clicking any server or user you can get id of them.

After obtaining all necessary environment details, edit application.yaml.

Database

Simply use the Docker Compose:

docker compose up

If you don't want to use docker then you should create a database called reddit_bot manually.

Thanks to Spring Boot JPA it will auto generate tables when the bot first run.

Example bot created by me

Check out the bot on top.gg

PREVIEW

PREVIEW.mp4

About

Java Spring Boot Discord bot that fetch posts from reddit and post them in discord. Reddit API, Firebase Storage API, Discord API and PostgreSQL used in this project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages