A basic Discord bot with music and AI capabilities.
Note
Since, discord-player and discord-player-youtubei have many problems, i decided to change into lavalink, shoukaku, and kazagumo. But don't worry, i'm still updating the discord-player version in dev v6.x.
You also need to configure the lavalink.
- Go to
serverfolder. - Lavalink server needs file named
application.yml, there's have 2 templates :application.yml.default.example, default config for lavalink.
Warning
This config doesn't support youtube, refer to lavalink issues
application.yml.example, editted config for support many plugins.
- Run the lavalink, use this command :
java -jar Lavalink.jarBefore running the bot, you need to set up your environment variables.
- Open the
.env.examplefile (located in theconfigdirectory) and add the following:- Bot Token: Obtain it from the Discord Developer Portal. Go to "Applications," select your bot, and copy the token.
- Client ID: Get it from your bot's Discord profile.
- Guild ID (Optional): This is your server ID. If you want the bot to be available globally, leave it empty.
- Lavalink Credentials: This is your lavalink credentials and it's important to fill it
- Rename
.env.exampleto.env.
If you want to enable AI functionality:
- Copy your OpenAI API key and add it to
api_keyinside the.envfile. - For additional security, add your role ID inside
config.jsonunderai_config->role. - Specify the Channel ID under
ai_config->channelinconfig.json. - Note: You must have an active OpenAI subscription. Refer to OpenAI Rate Limits for more details.
Nahida is built using discord.js, lavalink, shoukaku, kazagumo and openai.
- The bot token is required for authentication.
- The client ID identifies the bot.
- The guild ID (optional) ensures slash commands are registered only in a specific server.
- The Lavalink is required for audio nodes (as server).
- The shoukaku and kazagumo is required for music player.
Run the following command to install required packages:
If you are using bun, use this commands :
bun installor, if you are using node, use this commands :
npm installIf you encounter warnings, you can safely ignore them.
To start the bot, run :
npm run defor, if you're using bun, use this instead :
npm run fastEnsure you are in the bot's directory before executing the command.
Warning
This branch contains explicit content. Use it responsibly.
For a safer version, switch to the dev-safe branch:
git checkout dev-safeHaving trouble connecting to APIs? Check the HOSTS.md file for possible solutions.
Having trouble with the bot? Run the bot with the --debug={debug_level} flag to see what's the problem with bot. Or, you can do like this :
bun run debugEnjoy using Nahida! 🎵🤖