Prerequisites
What you need before writing code (Discord, Node.js, and an audio node).
Before you touch any code, make sure the "plumbing" is ready. Most Moonlink problems are not code problems — they’re usually missing intents, a wrong password, or a node that isn’t reachable.
Requirements
- Node.js:
v18.xor higher. - discord.js: v14.
- An audio server:
- NodeLink (recommended), or
- Lavalink v4.
Moonlink.js is the client. It does not stream audio by itself — it controls a NodeLink/Lavalink server.
Discord Developer Portal checklist
- Create an application.
- Create/enable the bot.
- Copy the token (treat it like a password).
- Invite the bot to your server.
Required intents
For a prefix-command music bot, you usually want:
Guilds(required)GuildVoiceStates(required for voice)GuildMessages+MessageContent(for reading!playstyle commands)
If you read message content (prefix commands), enable Message Content Intent in the Developer Portal and in your code.
Audio node checklist (NodeLink/Lavalink)
Before blaming the bot, verify:
- The node is running.
- Host/port/password are correct.
- If you use TLS, set
secure: true.
Best practice: run two nodes (main + backup). Even for small bots, this saves you from downtime.