Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add bindHook function #1846

Merged
merged 1 commit into from
Oct 23, 2023
Merged

feat: add bindHook function #1846

merged 1 commit into from
Oct 23, 2023

Conversation

twlite
Copy link
Collaborator

@twlite twlite commented Oct 23, 2023

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

  • These changes have been tested and formatted properly.
  • This PR includes only documentation changes, no code change.
  • This PR introduces some Breaking changes.

@twlite twlite added the area:main Related to discord-player label Oct 23, 2023
@vercel
Copy link

vercel bot commented Oct 23, 2023

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) Oct 23, 2023 5:10pm

@twlite twlite merged commit 2df1b39 into master Oct 23, 2023
4 checks passed
@twlite twlite deleted the bind-hooks branch October 23, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:main Related to discord-player
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant