My friends challenged me to build a music discord bot for our server, and I thought it would be a very fun side project!
There are many options to fetch music with node.js
such as using ffmpeg
and the youtube API - but I went with Lavalink
as it offers a more performant service.
Here was the challenge:
- Integrating typescript for bug-free code
- Installing lavalink server
- Using erela.js as a client for Lavalink
- Building a music command from scratch
- Building a playlist command from scratch
├───public
├───src/
│ Bot.ts
│ Client.ts
│ index.ts
│ Listener.ts
│ types.d.ts
├───commands/
├───embeds/
├───handlers/
│ └───playlist/
├───helpers/
├───interfaces/
├───models/
└───utils
│ index.ts
└───music/
- Node.js - JS runtime
- Dicsord.js - JS library
- Erela.js - Lavalink client
- MongoDB - Document database
- Typescript
- Bot deployed on Repl.it
- Lavlink server deployed on Repl.it based on Darren's repo: https://github.com/DarrenOfficial/lavalink-replit
Thanks for sharing 🚀