lavasearch

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

README

lavasearch-plugin

DisGoLink plugin for LavaSearch for advanced Lavalink search.

Installation

$ go get github.com/disgoorg/lavasearch-plugin

Usage

var client disgolink.Client
result, err := lavasearch.LoadSearch(client.BestNode().Rest(), "dzsearch:test", []lavasearch.SearchType{lavasearch.SearchTypeAlbum, lavasearch.SearchTypePlaylist})
if err != nil {
    // handle error
}

result.Albums // []lavasearch.Album
result.Playlists // []lavasearch.Playlist

Troubleshooting

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

Contributing

Contributions are welcomed but for bigger changes we recommend first reaching out via Discord or create an issue to discuss your problems, intentions and ideas.

License

Distributed under the License. See LICENSE for more information.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptySearchResult = errors.New("empty search result")
)

Functions

This section is empty.

Types

type SearchResult

type SearchResult struct {
	Tracks    []lavalink.Track    `json:"tracks"`
	Albums    []lavalink.Playlist `json:"albums"`
	Artists   []lavalink.Playlist `json:"artists"`
	Playlists []lavalink.Playlist `json:"playlists"`
	Texts     []Text              `json:"texts"`
}

func LoadSearch

func LoadSearch(client disgolink.RestClient, query string, types []SearchType) (*SearchResult, error)

LoadSearch loads a search result from Lavalink & returns a *SearchResult or ErrEmptySearchResult if no results were found or lavalink.Error if something went wrong with Lavalink or any other error.

type SearchType

type SearchType string
const (
	SearchTypeTrack    SearchType = "track"
	SearchTypeAlbum    SearchType = "album"
	SearchTypeArtist   SearchType = "artist"
	SearchTypePlaylist SearchType = "playlist"
	SearchTypeText     SearchType = "text"
)

type Text

type Text struct {
	Text   string           `json:"text"`
	Plugin lavalink.RawData `json:"pluginInfo"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL