ui/embeds.py, which keeps the modular UI consistent across the bot.
/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.
/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.
Helper Functions
Two helper functions inui/embeds.py are shared by multiple commands. They are not slash commands themselves, but they explain how the bot renders track metadata and artwork across the modular UI.
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.
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).
Related Topics
Playback Commands
Jump from diagnostics to the main playback and queue controls.
Command Overview
Review the full command catalog and where each command fits.
Module Reference
Map the utility helpers to the modular code structure behind them.
Testing Strategies
Validate the bot logic behind the command surface with pytest.