This is a Discord Music Bot written in TypeScript. It supports playing music from YouTube, Spotify, and SoundCloud. The bot uses the Discord.js library and the @discordjs/voice package to interact with the Discord API and handle voice connections.
- Node.js (v14 or higher)
- npm (v6 or higher)
- A Discord account and a server where you have permission to add a bot
- YouTube, Spotify, and SoundCloud API credentials
-
Clone the repository:
git clone https://github.com/kuronight29/Discord-Music-Bot-Typescript.git cd discord-music-bot-typescript
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add your credentials:DISCORD_BOT_TOKEN=YOUR_BOT_TOKEN BOT_PREFIX=! CLIENT_ID=YOUR_CLIENT_ID GUILD_ID=YOUR_GUILD_ID SOUNDCLOUD_CLIENT_ID=YOUR_SOUNDCLOUD_CLIENT_ID SPOTIFY_CLIENT_ID=YOUR_SPOTIFY_CLIENT_ID SPOTIFY_CLIENT_SECRET=YOUR_SPOTIFY_CLIENT_SECRET
-
Run the bot:
npm start
Displays a list of available commands and their descriptions. Use this command to get an overview of what the bot can do and how to use each command.
Plays a song from a given URL. Provide a YouTube, Spotify, or SoundCloud link to start playing music in your voice channel. Make sure you are in a voice channel before using this command!
Leaves the voice channel. Use this command to stop the bot and clear the queue.
Joins the voice channel you are in. Use this command to have the bot join your voice channel.
Sets the volume of the currently playing song. Use this command to adjust the volume level.
Displays the current music queue. Use this command to see what songs are in the queue.
- The bot supports YouTube, Spotify, and SoundCloud links.
- The bot will only play music in voice channels.
- The bot will automatically leave the voice channel after the queue is empty.
- The bot will not play music in text channels.