hermes - 💡(How to fix) Fix Spotify: gateway slash commands (/play, /pause, /skip, /nowplaying, /queue) [1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15612Fetched 2026-04-26 05:26:14
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Error Message

This way users without Spotify configured never see these commands in help, Telegram bot menus, Slack subcommand lists, or autocomplete — zero clutter. Dispatch still works if someone types them manually, returning a helpful 'Spotify isn't configured' error.

  • /pause and /skip work on Free accounts only if we gate with a clear error ('Spotify Premium required')

Fix Action

Fix / Workaround

This way users without Spotify configured never see these commands in help, Telegram bot menus, Slack subcommand lists, or autocomplete — zero clutter. Dispatch still works if someone types them manually, returning a helpful 'Spotify isn't configured' error.

  • plugins/spotify/gateway_commands.py — module exposing 5 handler functions that each call the underlying Spotify tool and format the result
  • gateway/run.py — one dispatch block that routes /play, /pause, /skip, /nowplaying, /queue to the handler module

Keeps the Spotify-specific logic in the plugin directory where it belongs, and the gateway just has a thin import + dispatch.

Code Example

/nowplaying
Miles DavisSo What (Kind of Blue) · 3:42 / 9:22 · Kitchen Sonos

/play blackbird acoustic
Now playing: Blackbird (Acoustic)Beatles · Kitchen Sonos

/pause
Paused on Kitchen Sonos

/skip
Skipped · next: Freddie FreeloaderMiles Davis

---

def _spotify_gateway_available() -> bool:
    # toolset enabled somewhere + Spotify authed
    from hermes_cli.auth import get_provider_auth_state
    state = get_provider_auth_state('spotify') or {}
    return bool(state.get('refresh_token'))
RAW_BUFFERClick to expand / collapse

Expose Spotify control as slash commands in messaging platforms (Discord, Telegram, etc.) so users don't need a full agent turn for common actions.

Depends on

  • Issue #15611spotify.default_device_name config knob. Without a reliable target device, slash commands hit 'no active device' too often to be worth shipping. See the end of that issue for the full rationale.
  • Or (alternatively) issue #15182 — Web Playback dashboard widget. Once the dashboard is a Spotify Connect device, slash commands have a guaranteed target whenever the dashboard tab is open.

One of the two must ship first. Slash commands after.

Proposal

Add 5 gateway-only slash commands:

CommandAction
/play [query]Play a track/album/artist. No query = resume current.
/pausePause playback.
/skipSkip to next track.
/nowplaying (alias: /np)Show current track, progress, device.
/queue <query>Add matched track to queue.

All five run in whichever gateway platform is active (Discord, Telegram, Slack, etc.) and respond with a terse formatted line rather than raw tool JSON:

/nowplaying
▶ Miles Davis — So What (Kind of Blue) · 3:42 / 9:22 · Kitchen Sonos

/play blackbird acoustic
▶ Now playing: Blackbird (Acoustic) — Beatles · Kitchen Sonos

/pause
⏸ Paused on Kitchen Sonos

/skip
⏭ Skipped · next: Freddie Freeloader — Miles Davis

Visibility gating

Current CommandDef supports gateway_config_gate: str (a single config dotpath). That's fine for simple flags but doesn't fit 'toolset enabled AND Spotify authenticated' which is two-factor runtime state.

Extension proposal: add gateway_availability_fn: Callable[[], bool] to CommandDef. _is_gateway_available() calls it if present. Falls back to gateway_config_gate then the cli_only default. ~20 LOC in hermes_cli/commands.py.

For Spotify the check is:

def _spotify_gateway_available() -> bool:
    # toolset enabled somewhere + Spotify authed
    from hermes_cli.auth import get_provider_auth_state
    state = get_provider_auth_state('spotify') or {}
    return bool(state.get('refresh_token'))

This way users without Spotify configured never see these commands in help, Telegram bot menus, Slack subcommand lists, or autocomplete — zero clutter. Dispatch still works if someone types them manually, returning a helpful 'Spotify isn't configured' error.

Where the handlers live

Don't add 5 individual handlers scattered across gateway/run.py. Instead:

  • plugins/spotify/gateway_commands.py — module exposing 5 handler functions that each call the underlying Spotify tool and format the result
  • gateway/run.py — one dispatch block that routes /play, /pause, /skip, /nowplaying, /queue to the handler module

Keeps the Spotify-specific logic in the plugin directory where it belongs, and the gateway just has a thin import + dispatch.

Acceptance

  • Commands appear in Discord/Telegram help ONLY when Spotify is authenticated
  • /nowplaying returns a single formatted line, not JSON
  • /play miles davis from Discord plays on the user's default device (or the dashboard tab if #15182 is the route we took)
  • /pause and /skip work on Free accounts only if we gate with a clear error ('Spotify Premium required')
  • Commands dispatched while Spotify isn't authed return 'Spotify not configured — run hermes auth spotify'
  • No regression on existing slash commands; gateway_availability_fn is additive

Non-goals

  • Search pickers / interactive result selection. /play X just plays the top search result. More complex flows are the agent's job.
  • Playlist management. Use the agent.
  • Per-user device targeting in multi-user gateways. v1 uses the bot's configured default device.

extent analysis

TL;DR

Implement the proposed slash commands for Spotify control in messaging platforms by first resolving the dependency on Issue #15611 or #15182.

Guidance

  • Review the dependency on Issue #15611 for spotify.default_device_name config knob or Issue #15182 for Web Playback dashboard widget to ensure a reliable target device for slash commands.
  • Implement the proposed gateway_availability_fn extension to CommandDef to gate command visibility based on Spotify authentication and toolset enabled state.
  • Create a plugins/spotify/gateway_commands.py module to handle Spotify-specific logic and keep the gateway code thin.
  • Test the implemented commands to ensure they appear in help only when Spotify is authenticated and function as expected.

Example

def _spotify_gateway_available() -> bool:
    from hermes_cli.auth import get_provider_auth_state
    state = get_provider_auth_state('spotify') or {}
    return bool(state.get('refresh_token'))

Notes

The implementation of slash commands depends on resolving the dependency on Issue #15611 or #15182. The proposed solution assumes that the gateway_availability_fn extension will be implemented to gate command visibility.

Recommendation

Apply the proposed solution by first resolving the dependency on Issue #15611 or #15182, and then implementing the gateway_availability_fn extension and the Spotify-specific logic in the plugins/spotify/gateway_commands.py module. This approach ensures a reliable target device for slash commands and gates command visibility based on Spotify authentication and toolset enabled state.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING