Using Connectors (Discord.js)
Cleaner setup by letting a Connector handle init, raw packets, and send().
In the previous guide we wired Moonlink manually using:
send(guildId, payload)client.on('raw', ...)manager.init(client.user.id)
That manual wiring is great for learning, but for many projects you’ll prefer using a Connector.
What a Connector does
A Connector acts as the bridge between Moonlink and your Discord library.
With the official Discord.js connector, it typically handles:
- calling
manager.init(...)at the right time - forwarding raw voice packets automatically
- implementing
send()for you
If you understand the manual setup, the connector setup will feel obvious — it’s the same flow, just packaged.
Discord.js Connector example
Use a Connector when you want less boilerplate and fewer “did I forget raw packets?” mistakes.