Skip to content

Repository files navigation

A Discord Music Bot written in TypeScript using Sapphire, discord.js, Next.js and React

imageimage

System dependencies

Setup bot

Create an application.yml file root folder.

Download the latest Lavalink jar from here and also place it in the root folder.

PostgreSQL

Linux

Either from the official site or follow the tutorial for your distro.

MacOS

Get brew, then enter 'brew install postgresql'.

Windows

Getting Postgres and Prisma to work together on Windows is not worth the hassle. Create an account on heroku and follow these steps:

  1. Open the dashboard and click on 'New' > 'Create new app', give it a name and select the closest region to you then click on 'Create app'.
  2. Go to 'Resources' tab, under 'Add-ons' search for 'Heroku Postgres' and select it. Click 'Submit Order Form' and then do the same step again (create another postgres instance).
  3. Click on each 'Heroku Postgres' addon you created, go to 'Settings' tab > Database Credentials > View Credentials and copy the each one's URI to either DATABASE_URL or SHADOW_DB_URL in the .env file you will be creating in the settings section.
  4. Done!

Redis

MacOS

brew install redis.

Windows

Download from here.

Linux

Follow the instructions here.

Settings (env)

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 URLDATABASE_URL="postgresql://john:doe@localhost:5432/master-bot?schema=public"# Bot TokenDISCORD_TOKEN=""NEXTAUTH_SECRET="somesupersecrettwelvelengthword"NEXTAUTH_URL=NEXTAUTH_URL_INTERNAL=http://localhost:3000NEXT_PUBLIC_INVITE_URL="https://discord.com/api/oauth2/authorize?client_id=yourclientid&permissions=8&scope=bot"# Next Auth Discord ProviderDISCORD_CLIENT_ID=""DISCORD_CLIENT_SECRET=""# LavalinkLAVA_HOST="0.0.0.0"LAVA_PASS="youshallnotpass"LAVA_PORT=2333LAVA_SECURE=false# SpotifySPOTIFY_CLIENT_ID=""SPOTIFY_CLIENT_SECRET=""# TwitchTWITCH_CLIENT_ID=""TWITCH_CLIENT_SECRET=""# Other APIsTENOR_API=""NEWS_API=""GENIUS_API=""RAWG_API=""

Gif features

If you have no use in the gif commands, leave everything under 'Other APIs' empty. Same applies for Twitch, everything else is needed.

DB URL

Change 'john' to your pc username and 'doe' to some password, or set the name and password you created when you installed Postgres.

Bot Token

Generate a token in your Discord developer portal.

Next Auth

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.

Next Auth Discord Provider

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.

Lavalink

You can leave this as long as the values match your application.yml.

Spotify and Twitch

Create an application in each platform's developer portal and paste the relevant values.

Pnpm

Install pnpm: npm install -g pnpm or on Windows iwr https://get.pnpm.io/install.ps1 -useb | iex or on Mac using Homebrew brew install pnpm

Running the bot

  1. If you followed everything right, hit pnpm i in the root folder. When it finishes make sure prisma didn't error.
  2. Open a separate terminal in the root folder and run 'java -jar Lavalink.jar' (must be running all the time).
  3. Wait a few seconds and run pnpm dev in the root folder in another terminal window.
  4. If everything works, your bot and dashboard should be running.
  5. Enjoy!

Commands

A full list of commands for use with Master Bot

Music

CommandDescriptionUsage
/playPlay any song or playlist from youtube, you can do it by searching for a song by name or song url or playlist url/play darude sandstorm
/pausePause the current playing song/pause
/resumeResume the current paused song/resume
/leaveLeaves voice channel if in one/leave
/removeRemove a specific song from queue by its number in queue/remove 4
/queueDisplay the song queue/queue
/shuffleShuffle the song queue/shuffle
/skipSkip the current playing song/skip
/skipallSkip all songs in queue/skipall
/skiptoSkip to a specific song in the queue, provide the song number as an argument/skipto 5
/volumeAdjust song volume/volume 80
/music-triviaEngage in a music trivia with your friends. You can add more songs to the trivia pool in resources/music/musictrivia.json/music-trivia
/loopLoop the currently playing song or queue/loop
/lyricsGet lyrics of any song or the lyrics of the currently playing song/lyrics song-name
/now-playingDisplay the current playing song with a playback bar/now-playing
/moveMove song to a desired position in queue/move 8 1
/queue-historyDisplay the queue history/queue-history
/create-playlistCreate a custom playlist/create-playlist 'playlistname'
/save-to-playlistAdd a song or playlist to a custom playlist/save-to-playlist 'playlistname' 'yt or spotify url'
/remove-from-playlistRemove a track from a custom playlist/remove-from-playlist 'playlistname' 'track location'
/my-playlistsDisplay your custom playlists/my-playlists
/display-playlistDisplay a custom playlist/display-playlist 'playlistname'
/delete-playlistremove a custom playlist/delete-playlist 'playlistname'

Gifs

CommandDescriptionUsage
/gifGet a random gif/gif
/jojoGet a random jojo gif/jojo
/gintamaGet a random gintama gif/gintama
/animeGet a random anime gif/anime
/bakaGet a random baka gif/baka
/catGet a cute cat picture/cat
/doggoGet a cute dog picture/doggo
/hugGet a random hug gif/hug
/slapGet a random slap gif/slap
/patGet a random pat gif/pat
/triggeredGet a random triggered gif/triggered
/amongusGet a random Among Us gif/amongus

Other

CommandDescriptionUsage
/fortuneGet a fortune cookie tip/fortune
/insultGenerate an evil insult/insult
/chucknorrisGet a satirical fact about Chuck Norris/chucknorris
/motivationGet a random motivational quote/motivation
/randomGenerate a random number between two provided numbers/random 0 100
/8ballGet the answer to anything!/8ball Is this bot awesome?
/rpsRock Paper Scissors/rps
/boredGenerate a random activity!/bored
/adviceGet some advice!/advice
/game-searchSearch for game information./game-search super-metroid
/kanyeGet a random Kanye quote/kanye
/world-newsLatest headlines from reuters, you can change the news source to whatever news source you want, just change the source in line 13 in world-news.js or ynet-news.js/world-news
/translateTranslate to any language using Google translate.(only supported languages)/translate english ありがとう
/aboutInfo about me and the repo/about
/urban dictionaryGet definitions from urban dictionary/urban javascript
/activityGenerate an invite link to your voice channel's activity/activity voicechannel Chill
/twitch-statusCheck the status of a Twitch steamer/twitch-status streamer: bacon_fixation

Resources

Getting a Tenor API key

Getting a NewsAPI API key

Getting a Genius API key

Getting a rawg API key

Getting a Twitch API key

Installing Node.js on Debian

Installing Node.js on Windows

Installing on a Raspberry Pi

Using a Repl.it LavaLink server

Using a public LavaLink server

Using an Internal LavaLink server

Contributing

Fork it and submit a pull request! Anyone is welcome to suggest new features and improve code quality!

Contributors ❤️

Bacon Fixation ⭐ - Countless contributions

ModoSN - 'resolve-ip', 'rps', '8ball', 'bored', 'trump', 'advice', 'kanye', 'urban dictionary' commands and visual updates

PhantomNimbi - bring back gif commands, lavalink config tweaks

Natemo6348 - 'mute', 'unmute'

kfirmeg - play command flags, dockerization, docker wiki

rafaeldamasceno - 'music-trivia' and Dockerfile improvements, minor tweaks

navidmafi - 'LeaveTimeOut' and 'MaxResponseTime' options, update issue template, fix leave command

Kyoyo - added back 'now-playing'

MontejoJorge - added back 'remind'

malokdev - 'uptime' command

chimaerra - minor command tweaks

About

A Discord music bot and dashboard with slash commands, playlist support, Spotify, music quiz, saved playlists, lyrics, gifs and more

Topics

Resources

Stars

493 stars

Watchers

20 watching

Forks

Releases

Packages

Used by

Contributors

Languages