source-plugins is a collection of additional audio sources for disgolink
go get github.com/disgoorg/source-plugins
import (
"github.com/disgoorg/disgolink/lavalink"
"github.com/disgoorg/source-plugins"
)
// create new lavalink and add the spotify plugin
link := lavalink.New(
lavalink.WithUserID("user_id_here"),
lavalink.WithPlugins(
source_plugins.NewNewSpotifyPlugin(),
source_plugins.NewAppleMusicPlugin(),
),
)
// when loading track you can type cast the track to an ISRCAudioTrack to access extra data
_ = link.BestRestClient().LoadItemHandler("https://open.spotify.com/track/3yk51U329nwdpeIHV0O5ez", lavalink.NewResultHandler(
func (track lavalink.AudioTrack) {
if spotifyTrack, ok := track.(*source_plugins.SpotifyAudioTrack); ok {
println("Spotify ISRC: ", spotifyTrack.ISRC)
println("Spotify ArtworkURL: ", spotifyTrack.ArtworkURL)
} else if appleMusicTrack, ok := track.(*source_plugins.AppleMusicAudioTrack); ok {
println("AppleMusic ISRC: ", appleMusicTrack.ISRC)
println("AppleMusic ArtworkURL: ", appleMusicTrack.ArtworkURL)
}
},
func (playlist lavalink.AudioPlaylist) {},
func (tracks []lavalink.AudioTrack) {},
func () {},
func (ex lavalink.FriendlyException) {},
))
For help feel free to open an issue or reach out on Discord
Contributions are welcomed but for bigger changes please first reach out via Discord or create an issue to discuss your intentions and ideas.