Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

disgoorg/source-plugins

Repository files navigation

Go Reference Go Report Go Version License Disgo Version Disgo Discord

source-plugins

source-plugins is a collection of additional audio sources for disgolink

Getting Started

Installing

go get github.com/disgoorg/source-plugins

Usage

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) {},
))

Troubleshooting

For help feel free to open an issue or reach out on Discord

Contributing

Contributions are welcomed but for bigger changes please first reach out via Discord or create an issue to discuss your intentions and ideas.

License

Distributed under the License. See LICENSE for more information.