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

Expose the track object instead of just the raw URL in createStream() #1919

Open retrouser955 opened 2 months ago

retrouser955 commented 2 months ago

Describe the feature you would like Instead of createStream(ext, url) being, expose the actual track instead of just the URL (createStream(track)). This would make devx way easier.

@discord-player/extractor

twlite commented 2 months ago

Can you provide an example

retrouser955 commented 2 months ago

Can you provide an example

Current

player.extractors.register(SpotifyExtractor, {
  async createStream(ext, url) {
    const trackData = await ext.handle(url)
    const search = searchOnYoutube(`${trackData.author} - ${trackData.title}`)
    const streamURL = getStreamURL(search.url)
    return streamURL
  }
})

Change

player.extractors.register(SpotifyExtractor, {
  async createStream(ext, track) {
    const search = searchOnYoutube(`${track.author} - ${track.title}`)
    const streamURL = getStreamURL(search.url)
    return streamURL
  }
})
twlite commented 2 months ago

Ok doesn't seem complicated, lets add track as the 3rd parameter to avoid breaking changes

retrouser955 commented 2 months ago

Ok doesn't seem complicated, lets add track as the 3rd parameter to avoid breaking changes

Alright thanks!