Pulsifyy helps you add music to a Discord bot. Your bot receives a song request, Pulsifyy manages the queue, and a Lavalink v4 server streams the audio into the voice channel.
One Manager handles the voice packets and Lavalink connections for your bot. Each guild gets its own player and queue, so a skip, filter change, or repeat command affects only that guild.
Community & support
Start with troubleshooting if your bot joins voice and stays silent. To report a bug, open a GitHub issue with the failing command and your library and server versions.
Quickstart
Start with one working audio source and one voice channel. You can add Pulsifyy to a bot you already run or try the complete starter in a new folder.
Install Pulsifyy
In a bot project using Node.js 22.19 or newer, run the command below. If you are starting in an empty folder, run npm init -y there first. The npm package name is pulsifyy, with two y’s.
npm install pulsifyy
discord.js is optional for running Pulsifyy. If your bot already receives Discord gateway events, follow the existing-client steps. If you want a bot you can run from scratch, follow the discord.js starter. Both paths use a Lavalink node.
Prepare a Lavalink node
A node is one Lavalink server your bot can ask to find and play audio. If you already have one, get its host, port, password, and TLS setting. Check that SoundCloud search is enabled for this example.
To run your own node, follow the Lavalink v4 installation guide. Save this application.yml beside Lavalink.jar, choose a password, then run java -jar Lavalink.jar. Leave it running while you start the bot.
Create one Manager at startup and share it across your bot’s commands. It needs a way to send a voice join or leave request through the Discord connection that owns the target server. Discord calls a server a guild, so guildId means server ID.
The function below takes a callback you supply, sendToGuild(guildId, payload). Implement that callback with your client’s gateway send method and pass the payload through unchanged. Set the LAVALINK_* environment variables to match your node.
Call createMusicManager(sendToGuild) once and keep the returned manager. Enable the Guilds and Guild Voice States intents in your Discord client.
In your client’s raw gateway handler, forward VOICE_STATE_UPDATE and VOICE_SERVER_UPDATE packets to manager.updateVoiceState(packet) and handle any rejected promise. The packets carry the details Lavalink uses to join voice.
When Discord signals that your bot is ready, call manager.init(botUserId) with the logged-in bot’s user ID. When you see Lavalink connected, your node is ready for a first search. To play the result, create a player for the listener’s guild.
Run the optional discord.js starter
The starter uses discord.js 14 to log in and read messages such as !play. In the folder where you installed Pulsifyy, add the starter’s Discord client.
npm install discord.js@14
Create a bot in the Discord Developer Portal, enable Message Content Intent on its Bot page, and invite it to a test server with View Channel, Send Messages, Connect, and Speak permissions. Message Content lets this example read its text commands.
Download the starter bot into the new project using the command for your shell.
Wait for the Discord login and Lavalink connection messages. Join a voice channel and send !play song name to the bot. You can also use an HTTPS link from soundcloud.com. Try !pause, !resume, !skip, and !leave once playback starts.
A player is the voice connection and playback queue for one Discord server. Reuse the same player when someone in that server requests another song.
Create a player and start playback
Wait for the manager's nodeConnect event before running playback commands. You need the server ID, the listener’s voice channel ID, the text channel ID for replies, and a song name or URL. The example reads those from a discord.js message. With another client, get the same values from its command handler.
const { LoadTypes, SearchPlatform } = require("pulsifyy");
asyncfunction queueTracks(manager, message, query) {
const voice = message.member?.voice.channel;
if (!voice) return message.reply("Join a voice channel first.");
const guildId = message.guild.id;
const existing = manager.players.get(guildId);
if (existing && existing.voiceChannelId !== voice.id) {
return message.reply("Join my voice channel to control playback.");
}
const result = await manager.search(query, message.author, SearchPlatform.SoundCloud);
if (!result.tracks.length) return message.reply("No tracks found.");
const player = existing ?? manager.create({
guildId, voiceChannelId: voice.id, textChannelId: message.channel.id, selfDeafen: true,
});
player.connect();
const tracks = result.loadType === LoadTypes.Playlist ? result.tracks : [result.tracks[0]];
player.queue.add(tracks);
if (!player.playing && !player.paused && player.queue.current) await player.play();
}
Control playback and the queue
Read player.queue.current for the current track. queue.length counts upcoming tracks and queue.totalSize includes the current track. Call queue.clear() to remove upcoming tracks while the current one plays.
await player.pause(true);
await player.pause(false);
await player.setVolume(50);
await player.seek(30_000); // Seekable tracks only, in milliseconds.await player.stop(); // Skip the current track.await player.destroy(); // Remove the player and leave voice.
Repeat and autoplay
Choose player.setTrackRepeat(true) or player.setQueueRepeat(true) to repeat the current track or queue. Enable recommendations with player.setAutoplay(true, client.user, 3) and turn them off with player.setAutoplay(false). Set autoPlaySearchPlatforms on the manager to choose recommendation sources your node supports.
Start with SoundCloud, then choose how your bot searches for tracks, loads links, and handles the results.
Run your first SoundCloud search
SearchPlatform tells Pulsifyy which search prefix to send to Lavalink. The provider runs on the Lavalink node, where it looks up tracks and resolves playback. Picking a source in JavaScript only works if the node has its provider enabled.
Follow Quickstart to get a bot connected to Lavalink. The starter uses Lavalink's built-in SoundCloud provider.
In the node's application.yml, enable lavalink.server.sources.soundcloud and lavalink.server.soundcloudSearchEnabled. Preserve the other settings and restart Lavalink after making changes.
Wait for the startup message Lavalink connected, then join a voice channel and send !play artist song. Use a song available on SoundCloud.
In an async command handler, let requester be the user who asked for the song. For example, the discord.js starter gets that user from message.author. Try a real artist and song title and inspect the first match before adding anything to the queue.
const { SearchPlatform } = require("pulsifyy");
const result = await manager.search(
"artist song", requester, SearchPlatform.SoundCloud,
);
console.log(result.tracks[0]?.title ?? "No matches");
Choose a default or override it
Omitting a source uses defaultSearchPlatform for text queries. Pulsifyy defaults to Deezer, so set defaultSearchPlatform: SearchPlatform.SoundCloud in your existing new Manager({ ... }) options if you only enabled SoundCloud.
// Use the manager's configured default.await manager.search(query, requester);
// Use Bandcamp for this request. Enable its provider on Lavalink first.await manager.search(query, requester, SearchPlatform.Bandcamp);
// Try SoundCloud first and Bandcamp if the first lookup cannot load a result.await manager.search(query, requester, [
SearchPlatform.SoundCloud, SearchPlatform.Bandcamp,
]);
When a guild already has a player, you can call player.search() with the same arguments. If you use several Lavalink nodes, enable the source on each node that may receive a request.
Load links and handle results
Pass a full HTTP(S) track or playlist URL as the query to load that exact link. Pulsifyy sends the URL directly to Lavalink, where an enabled source handles it. The text-search default and overrides apply to song names. The Quickstart bot accepts HTTPS links from soundcloud.com.
LoadTypes.Search returns alternative matches. Queue the first result or offer the user a choice.
LoadTypes.Track returns one track. LoadTypes.Playlist returns the collection in order.
LoadTypes.Empty returns an empty tracks array. A failed load or unavailable node can reject the request.
Here is a helper for the starter’s message handler. It replies when loading fails or finds nothing, and returns the number of tracks it queued. In another Discord client, substitute its user and reply methods.
const { LoadTypes, SearchPlatform } = require("pulsifyy");
async function queueRequestedTracks(player, message, query) {
let result;
try {
result = await player.search(query, message.author, SearchPlatform.SoundCloud);
} catch (error) {
console.error(error);
await message.reply("I couldn't load tracks. Try again in a moment.");
return0;
}
if (!result.tracks.length) {
await message.reply("I couldn't find any tracks.");
return0;
}
const tracks = result.loadType === LoadTypes.Playlist ? result.tracks : [result.tracks[0]];
player.queue.add(tracks);
return tracks.length;
}
See Player management for creating the player and starting playback after adding tracks.
Enable providers on Lavalink
These are the built-in SearchPlatform options in Pulsifyy. Install any required plugin on the Lavalink server, enable the provider, and restart the node. The prefix below is what Lavalink receives before the search text.
Source
Enum member
Prefix
Lavalink setup
Apple Music
AppleMusic
amsearch:
PulseLink. Set up a playback mirror. Media API token is optional.
Audiomack
AudioMack
admsearch:
PulseLink. Built-in credentials can be overridden.
Bandcamp
Bandcamp
bcsearch:
Enable Lavalink's built-in bandcamp source.
Deezer
Deezer
dzsearch:
PulseLink. Configure arl and masterDecryptionKey.
Gaana
Gaana
gnsearch:
PulseLink. Enable the provider.
JioSaavn
Jiosaavn
jssearch:
PulseLink. Enable the provider and use its defaults.
SoundCloud
SoundCloud
scsearch:
Enable built-in SoundCloud and soundcloudSearchEnabled, or enable PulseLink's provider. Choose one per node.
Spotify
Spotify
spsearch:
PulseLink. Set up a playback mirror.
Tidal
Tidal
tdsearch:
PulseLink. Configure a mirror or the documented direct playback requirements.
VK Music
VKMusic
vksearch:
PulseLink. Configure userToken.
YouTube
YouTube
ytsearch:
Enable the youtube-source plugin and its search option.
YouTube Music
YouTubeMusic
ytmsearch:
Use the same plugin with its MUSIC search client and a playback-capable client.
Use YouTube and YouTube Music at your own risk. In 2021, YouTube sent cease-and-desist notices to the original Groovy and Rythm Discord music bots. Review the YouTube Terms of Service and use content you have permission to play.
A playback mirror finds audio for a track whose original service supplies metadata. For example, a Spotify search can identify a track successfully while playback still depends on mirrors configured in PulseLink. See PulseLink providers and mirroring, Lavalink configuration, and YouTube plugin setup.
Autoplay picks recommendations separately from text search. Configure autoPlaySearchPlatforms with the AutoPlayPlatform values for Deezer, JioSaavn, SoundCloud, Spotify, Tidal, or VK Music. Last.fm is an optional recommendation fallback when you configure lastFmApiKey.
Troubleshoot a failed lookup
No available nodes. Check that Lavalink started, wait for nodeConnect, and verify the host, port, password, and TLS settings.
No tracks for a song name. Try a known search from an explicitly selected source, then check the node's provider and search settings. A successful direct URL load only verifies that URL path.
Search works and playback fails. Check the node's playback error and the provider credentials or mirrors. If every source fails after the bot joins voice, check Discord voice events and permissions.
Change what listeners hear in a Discord voice channel. Boost the bass, adjust the tempo and pitch, or move the sound between stereo channels while a track plays.
Apply an effect
Start a track with the Quickstart. In an async handler, use your initialized manager and the Discord server's ID as guildId to find its player. The guard makes sure there is a track to listen to before you change its sound.
const player = manager.get(guildId);
if (!player?.queue.current || !player.playing) {
throw new Error("Start or resume a track in this server first.");
}
await player.filters.nightcore(true);
The track should sound faster and higher pitched. Await each change and handle any rejection in your command handler before reporting success.
Choose a preset
Presets set the filter values for you. Pass true to turn a preset on and false to turn it off. With bassBoost(), try 1 for a mild boost, -1 for a mild cut, or 0 to turn it off.
Method on player.filters
What listeners hear
Required Lavalink filters
nightcore(true)
Faster playback and a higher pitch.
timescale
slowmo(true)
Slower playback at the original pitch.
timescale
bassBoost(1)
A mild boost to the low end.
equalizer
eightD(true)
Sound that moves between stereo channels.
rotation and channelMix
Nightcore and slowmo both use timescale. To switch from nightcore to slowmo, turn nightcore off first. Bass boost can stay on alongside either preset because it uses the equalizer.
Clear any active presets, then set the effects you want to combine. This example adds a small boost at 63 and 100 Hz and speeds the track up by 5% with the original pitch and rate.
The equalizer and timescale can run together. To tune the bass, choose the bands closest to the frequencies you want to change. See the Lavalink equalizer bands and gain range.
Reset the player
For the custom setup above, call await player.filters.setTimescale() to remove the speed adjustment and keep the equalizer. Call await player.filters.setEqualizer([]) to clear the equalizer. To reset the filters together, use clearFilters().
await player.filters.clearFilters();
The track and queue stay in place.
Troubleshoot an effect
No audible change. Confirm the track is playing on the player for this server. Use the same passage to compare the sound before and after a clearly audible preset such as nightcore.
Lavalink rejects the change. Check player.node.info?.filters after the node connects. Every filter used by the preset needs to be enabled on that node. If the effects are present, check the supplied values and the Lavalink error before retrying.
Looking for reverb. Stock Lavalink v4 has no built-in reverb. See the Lavalink filter list for supported effects.
Find the remaining methods and option types in the API reference.
Events and listeners
A listener is a function Pulsifyy calls when something happens. A play command asks Lavalink to start a track. A trackStart event tells your bot that Lavalink has reported the start.
Register listeners
Find the new Manager(...) in your bot's startup file. Place the following listeners immediately after it, before manager.init(). Each listener handles events for every guild served by that manager. If you're using the quickstart, replace its existing listeners for the same events.
Try this with the starter bot, one guild, and two short playable tracks. Leave playNextOnEnd enabled (the default) and turn repeat and autoplay off. Once both songs are queued, let them finish without sending more playback commands.
Start the bot. nodeConnect fires after a node is ready. A reconnect can produce another nodeConnect for that node.
Queue the first track and start playback. Its trackStart listener prints the title. Queue the second track while the first plays.
When the first track finishes, trackEnd receives that track and the reason finished. The manager advances the queue and requests playback. Lavalink's next start event produces trackStart for the second track.
When the second track finishes, expect its trackEnd, then queueEnd for the empty queue. Your bot can stay connected and accept another play command.
Repeat can select a track again. Autoplay can find a recommendation before queueEnd fires. Clearing upcoming items while a track plays also leaves that track running. Use the track argument to identify the song that ended because player.queue.current can already point to the next song. See players and queues.
Common events
The node identifies the Lavalink server. The player belongs to one Discord guild. The track holds Pulsifyy's track metadata, and payload contains event details from Lavalink. List only the arguments your listener uses.
Event
Listener arguments
What to inspect
nodeConnect
node
node.options.identifier names the ready server.
nodeError
node, error
error.message describes the node problem.
trackStart
player, track, payload
player.guildId and track.title identify the playback.
trackEnd
player, track, payload
payload.reason distinguishes a natural finish from a stop or load failure.
trackError
player, track, payload
payload.exception describes a track exception that your recovery callback did not handle.
queueEnd
player, track, payload
track is the last track and payload is its end event.
Node's event emitter calls listeners synchronously and continues as soon as each returns. A failed file write or Discord message send can reject later. Catch that failure inside the listener. This CommonJS example records one JSON line per trackEnd event in the bot's working directory, including the reason the track ended.
Each start prints twice. Check manager.listenerCount("trackStart") and inspect each registration. Registering inside a play command adds another listener on every command. For a reloadable module, call manager.off("trackEnd", recordTrackEnd) on teardown using the same function you registered.
The queue skips a song. With automatic advancement enabled, a trackEnd listener can observe the transition without calling stop() or play() a second time.
One server stays silent. Include player.guildId and the node identifier in your logs. If a start prints but the channel gets no message, inspect the channel lookup, permissions, and rejected send. If no track starts, check nodeError and trackError, then follow troubleshooting.
Node configuration
Configure node selection, request timeouts, and resource limits for your bot.
Connect multiple nodes
Start with one node. Add a second when you need another server to share the playback load or take over during recovery. The example below uses the discord.js starter’s shard callback. For another client, reuse the gateway callback from quickstart. Set each node's host, password, and optional port in the manager. Give each node a distinct identifier. Pass a hostname without a URL scheme and set useSSL: true when the endpoint uses TLS.
Use UseNodeOptions.LeastLoad for CPU-based selection, or set enablePriorityMode and each node's nodePriority for weighted selection. Configure each node's sources and plugins before directing players to it.
Tune timeouts, caching, and queues
Option
Behavior
apiRequestTimeoutMs
Bounds requests to the Lavalink node.
maxRetryAttempts, retryDelayMs
Configure how the node reconnects.
trackCacheMaxEntries, trackCacheTtlMs
Limit manager search caching. Set either to zero to disable it.
maxQueueSize, maxPreviousTracks
Limit queued and previously played tracks per guild.
playerInactivityTimeoutMs
Clears idle players after the configured interval. Zero disables it.
Continue to Session recovery to persist player state and configure resuming.
Session recovery
Resume Lavalink sessions and restore playback state after a disconnect.
Enable resuming on a node
Add enableSessionResumeOption to the node in your manager options. sessionTimeoutMs controls how long Lavalink retains the session after a disconnect.
Pulsifyy first attempts to resume on the same node. If that session survives, playback stays in place. A fresh session can restore saved players and request new voice connections. If reconnects are exhausted, Pulsifyy tries other ready nodes.
Persist state across restarts
Keep sessionDataPath on a persistent location and use the same bot and cluster IDs when calling manager.init(clientId, clusterId) after a restart. The default storage root is pulsify/, with a fallback to an existing magmastream/ directory.
Await manager.handleShutdown() before your process exits. Keep saved session data private and check the troubleshooting guide if playback fails to recover.
API reference
Find the main Pulsifyy classes, option types, and entry points.
Import Pulsifyy
The package supports ES modules and CommonJS. Use the import style already used by your bot.
// ES modulesimport { Manager, SearchPlatform } from"pulsifyy";
Pulsifyy ships its own declarations. They reference discord.js types for users and messages. If TypeScript checks dependency declarations and reports Cannot find module 'discord.js', add discord.js as a development dependency. For a Node.js 22 project, use the command below to install it with matching Node types. Your runtime can continue using your chosen Discord client.
npm install -D discord.js@14 @types/node@22
Main classes
Export
Usage
Manager
Initialize Lavalink connections, create players, and search tracks.
Player
Control playback and the voice connection for a guild.
Queue
Manage the current, upcoming, and previous tracks on a player.
Filters
Apply equalizer, timescale, and other supported effects.
Node
Represent a Lavalink connection and its connection state.
Diagnose connection, playback, and search problems before reporting an issue.
Common problems
Symptom
What to check
No available nodes
Wait for nodeConnect and verify the node host, port, password, TLS, and firewall.
Bot ignores !play
Enable Message Content Intent in Discord and the client. Confirm the bot can view and send messages in the channel.
Bot joins and stays silent
Forward raw Discord events to manager.updateVoiceState(). Check Guild Voice States intent, Connect and Speak permissions, and Lavalink track errors.
Search returns no tracks
Enable the requested source on Lavalink and check any required plugin credentials.
Session fails to recover
Enable session resuming, keep the session storage directory, and check whether the server session survived.
Report an issue
Open an issue on GitHub with the versions of Node.js, Pulsifyy, your Discord client, Lavalink, and any relevant source plugin. Include the failing command or public track URL, the error message, and a small reproduction. Remove bot tokens, passwords, and provider credentials before sharing logs.