Androz2091 / discord-player

🎧 Complete framework to simplify the implementation of music commands using discord.js v14
https://discord-player.js.org/
MIT License
589 stars 192 forks source link

feat: add bindHook function #1846

Closed twlite closed 10 months ago

twlite commented 10 months ago

Changes

Currently the hooks exported by discord-player operate on the first instance of Player. This PR adds a new function called bindHook which allows users to bind hooks to other instance of player.

import { bindHook, useMainPlayer, Player } from 'discord-player'

// create player instance
const player = new Player(client, {...});

// bind hooks to 'player'
bindHook(player);

useMainPlayer() // this equals to 'player' above

This by default uses first instance for compatibility reasons.

Status

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **discord-player-website** | ⬜️ Ignored ([Inspect](https://vercel.com/androz2091/discord-player-website/9ad2mBjA25A9GDHig8Rbb7Fcht2H)) | | Oct 23, 2023 5:10pm |