The utility commands round out the bot’s feature set with diagnostic and informational tools.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DJERLO/Simple-Discord-Music-Bot-Using-Nextcord/llms.txt
Use this file to discover all available pages before exploring further.
/nowplaying surfaces a detailed embed for the active track, /ping reports the bot’s WebSocket latency so you can spot connection issues, and /help gives any user a quick reference of every available slash command. All three commands respond ephemerally, keeping channel clutter to a minimum. They also depend on two internal helper functions — format_time and get_track_artwork — that are shared across the entire codebase.
/nowplaying
Sends a detailed embed for the track currently being played, including artist, duration, artwork, and who requested it.
/nowplaying reads the active track from vc.current and builds a rich embed using the same metadata and helper functions used by the automatic Now Playing message. Because the embed is sent ephemerally, each user can request it independently without flooding the channel.
Behavior
- Checks that
vcis notNoneand thatvc.playingisTrue; sends an error and returns early otherwise. - Reads the current track from
vc.current. - Builds a
nextcord.Embedwith:- Title:
💿 Currently Playing - Description: a clickable hyperlink formatted as
[track.title](track.uri) - Color: blue (
nextcord.Color.blue()) - Field “Artist”:
track.author(inline) - Field “Duration”:
format_time(track.length)in M:SS format (inline) - Thumbnail: resolved by
get_track_artwork(track)(set only if a URL is found) - Footer:
"Requested by {requester}"with the requester’s avatar, sourced fromtrack.extras
- Title:
- Sends the embed as an ephemeral message.
| Situation | Response |
|---|---|
| Bot is not playing anything | "Nothing is currently playing." (ephemeral) |
/ping
Reports the bot’s current WebSocket latency in milliseconds.
/ping reads bot.latency, which Nextcord exposes as the round-trip time of the WebSocket heartbeat in seconds. The command multiplies it by 1000 and rounds to the nearest integer to produce a millisecond value that is easier to read.
Behavior
- Reads
bot.latency(a float, measured in seconds). - Computes
latency_ms = round(bot.latency * 1000). - Sends
"Pong! Latency: {latency_ms}ms"ephemerally.
WebSocket latency reflects the heartbeat connection between the bot process and Discord’s gateway, not audio stream latency from Lavalink. High values here typically indicate network issues between the host machine and Discord.
/help
Sends a formatted list of every available slash command with a one-line description of each.
/help hard-codes the list of all registered slash commands into a single ephemeral text message. It covers every command documented across the Command Reference, making it a useful quick-reference for server members who are unfamiliar with the bot.
Behavior
- Builds a multi-line string listing all available commands and their purposes.
- Sends the string as an ephemeral message.
| Command | Description shown |
|---|---|
/play [song name or URL] | Play a song or add it to the queue |
/skip | Skip the currently playing song |
/pause | Pause the currently playing song |
/resume | Resume the currently paused song |
/shuffle | Shuffle the current music queue |
/nowplaying | Show details of the currently playing song |
/stop | Stop playback and clear the queue |
/queue | Show the current music queue |
/clearqueue | Clear the current music queue |
/ping | Check the bot’s latency |
/help | Show the help message |
Helper Functions
Two helper functions defined inbot.py are shared by multiple commands. They are not themselves slash commands, but understanding them clarifies how track metadata is rendered throughout the bot.
format_time
Converts a duration in milliseconds to a human-readable M:SS string. It is used by /play, /nowplaying, and the on_wavelink_track_start event to format track lengths consistently.
| Input (ms) | Output |
|---|---|
180000 | "3:00" |
3661000 | "61:01" |
90500 | "1:30" |
Hours are not broken out separately — a three-hour track would display as
"180:00". The format keeps things simple for typical song lengths.get_track_artwork
Resolves the best available artwork URL for a wavelink.Playable track. It is used by /play and /nowplaying, and by the on_wavelink_track_start event handler.
track.artwork— the primary artwork attribute provided by Wavelink.track.thumbnail— a fallback attribute present on some track types.- If neither is set and
track.sourcecontains'youtube', constructs a YouTube thumbnail URL:https://i.ytimg.com/vi/{track.identifier}/hqdefault.jpg. - Returns
Noneif no artwork can be found (callers guard against this before callingset_thumbnailorset_image).