A Discord Bot written in TypeScript using Sapphire, discord.js, Next.js and React
Either from the official site or follow the tutorial for your distro.
Get brew, then enter 'brew install postgresql'.
Download from here
brew install redis
.
Download from here.
Follow the instructions here.
Create a .env
file in the root directory and copy the contents of .env.example to it.
Note: if you are not hosting postgres on Heroku you do not need the SHADOW_DB_URL variable.
# DB URL
DATABASE_URL="postgresql://john:doe@localhost:5432/botlog?schema=public"
SHADOW_DB_URL="postgresql://john:doe@localhost:5432/botlog?schema=public"
GUILD_ID=
# ECONOMY
COIN_NAME=""
COIN_EMOJI=""
RED_COLOR="F5463D"
GREEN_COLOR="3DF556"
CASH_PER_CHAT=1
MIN_CASH_PER_CHAT=5
MAX_CASH_PER_CHAT=12
STARTING_CASH=200
INTERVAL=60
SNIPE_COST=200
SINGLE_SNIPE_COST=100
ROB_CHANCE=0.x
ROB_CHANCE_THIEF=0.x
ROB_CHANCE_MOD=0.x
ROB_RATE=0.x
ROB_RATE_THIEF=0.x
ROB_COOLDOWN=
ROB_COOLDOWN_THIEF=1
ROLE_ID_THIEF=
ROLE_ID_INMATE=
HEIST_WAITING_TIME=
HEIST_JAIL_TIME=
HEIST_REDUCED_JAIL_TIME=
HEIST_BASE_CHANCE=0.x
HEIST_ADDITIONAL_CHANCE=0.x
HEIST_BASE_RATE=0.x
HEIST_ADDITIONAL_RATE=0.x
HEIST_MAX_MEMBERS=5
HEIST_COOLDOWN=604800
COINFLIP_COOLDOWN=600
# Bot Token
# DISCORD_TOKEN=""
DISCORD_TOKEN=""
CAT_API=""
DOG_API=""
CLIENT_ID=""
CLIENT_SECRET=""
PREFIX=""
RAWG_API=""
TENOR_API=""
WEATHER_API=""
YOUTUBE_API=""
# Next Auth
NEXTAUTH_SECRET="somesupersecrettwelvelengthword"
NEXTAUTH_URL=http://domain:3000
NEXTAUTH_URL_INTERNAL=http://localhost:3000
NEXT_PUBLIC_INVITE_URL="https://discord.com/api/oauth2/authorize?client_id=yourclientid&permissions=8&scope=bot"
# Next Auth Discord Provider
DISCORD_CLIENT_ID=""
DISCORD_CLIENT_SECRET=""
# Spotify
SPOTIFY_CLIENT_ID=""
SPOTIFY_CLIENT_SECRET=""
# Lavalink
LAVA_HOST=""
LAVA_PASS=""
LAVA_PORT=
LAVA_SECURE=
# Redis
REDIS_HOST="127.0.0.1"
REDIS_PORT=6379
REDIS_PASSWORD=""
REDIS_DB=1
# ChatGPT
SESSION_TOKEN=""
If you have no use in the gif commands, leave everything under 'Other APIs' empty. Same applies for Twitch, everything else is needed.
Change 'john' to your pc username and 'doe' to some password, or set the name and password you created when you installed Postgres.
Generate a token in your Discord developer portal.
You can leave everything as is, just change 'yourclientid' in NEXT_PUBLIC_INVITE_URL to your Discord bot id and then change 'domain' in NEXTAUTH_URL to your domain or public ip. You can find your public ip by going to www.whatismyip.com.
Go to the OAuth2 tab in the developer portal, copy the Client ID to DISCORD_CLIENT_ID and generate a secret to place in DISCORD_CLIENT_SECRET. Also, set the following URLs under 'Redirects':
Make sure to change 'domain' in http://domain:3000/api/auth/callback/discord to your domain or public ip.
Create an application in each platform's developer portal and paste the relevant values.
- If you followed everything right, hit
npm i
in the root folder. When it finishes make sure prisma didn't error. - Wait a few seconds and hit
npm run dev
. - If everything works, your bot and dashboard should be running.
- Enjoy!
Using a Repl.it LavaLink server
Using a public LavaLink server
Using an Internal LavaLink server
Fork it and submit a pull request! Anyone is welcome to suggest new features and improve code quality!