Overview
TheuseMainPlayer hook provides access to the main Player instance within command contexts. This is the primary entry point for interacting with Discord Player’s core functionality.
Usage
Signature
Return Value
The main Player instance with all core functionality including:
search()- Search for tracksplay()- Play tracks in a voice channelqueues- Access to all guild queuesextractors- Manage audio extractorsevents- Player event emitter
When to Use
UseuseMainPlayer when you need to:
- Search for tracks before playing
- Access the global player configuration
- Manage extractors or plugins
- Create new queues
- Access player-level events
Example: Play Command
Example: Search Command
Related Hooks
- useQueue - Access guild queue
- useTimeline - Control playback
- useHistory - Access queue history