SongBoy is a Discord bot that mostly acts as a DJ, taking song requests and playing them over voice channels. Music is provided by YouTube. It utilizes Google Text-to-Speech and ChatGPT to provide more personal interactions, such as flavorful DJ hooks and a chat functionality.
It stores all requested songs in a database which powers the random command and can be useful for future shenanigans.
/song query: string
Plays a song or add it to the queue. You must be in a public voice channel to use this command.
/queue
See the current songs in queue.
/top query: number
Shows the n
top most requested songs
/skip
Skips the current song
/random
Get a random song from the pool of all songs that have been played in the past. Songs requested more often are weighted to be chosen more frequently.
/stop
Stop the bot. He should resume on any subsequent commands. Useful for recovering from error states without requiring a reboot.
EXPERIMENTAL BETA COMMANDS
/chat query: string
Ask SongBoy to converse with you. This is currently powered by ChatGPT.
- Clone repo & create a bot via the Discord Developer Portal
- Set discord environment variables
DISCORD_BOT_TOKEN=xxx
CLIENT_ID=xxx
GUILD_ID=xxx
- Set up keys for Google API (YouTube) and *.json credentials (TTS)
GOOGLE_API_KEY=xxxx
GOOGLE_APPLICATION_CREDENTIALS=foo.json
- Install mongodb and create a database for any environments you need & testing
MONGO_URL=
MONGO_TEST_URL=
- If you want to use the experimental chat feature, add openai API key and set enabled flag to true
OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
CHAT_ENABLED=true
- Invite bot to server
- Deploy commands to Discord. You can run this remotely or locally as long as the discord tokens are set.
$ npm run deploy-commands
- Start the bot
Production
$ npm start
Development
$ npm run start:dev