Skip to main content

ruvyrias / Exports / Deezer

Installation

// Just import the class from Ruvyrias
const { Deezer } = require('ruvyrias');

Example usage basic bot

const { Client, GatewayIntentBits } = require('discord.js');
const { Deezer } = require('ruvyrias');
const deezer = new Deezer();

const RuvyriasOptions = {
library: 'discord.js',
defaultPlatform: 'dzsearch',
plugins: [deezer],
};

const nodes = [
{
name: 'local-node',
host: 'localhost',
port: 2333,
password: 'youshallnotpass',
},
];

// The entire code of a bot can be found at the main page, i'll not repeat all things here
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
],
});

client.ruvyrias = new Ruvyrias(client, nodes, RuvyriasOptions);

/**
* You can use the source property to search by name or it will use the defaultPlatform to search by name
* Links will work directly, and it serves to any platform, but plugins has to be loaded before (unless you have lavaSrc)
*/
const res = await client.ruvyrias.resolve({ query: 'alan walker alone', source: 'dzsearch', requester: message.author });

Class: Deezer

Represents the Deezer class, extending the base Plugin class.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Deezer(): Deezer

Returns

Deezer

Overrides

Plugin.constructor

Defined in

plugins/deezer/Deezer.ts:115

Properties

_resolve

Private _resolve: (__namedParameters: ResolveOptions) => any

Type declaration

▸ («destructured»): any

Parameters
NameType
«destructured»ResolveOptions
Returns

any

Defined in

plugins/deezer/Deezer.ts:114


baseURL

Private baseURL: string = DEEZER_PUBLIC_API

Defined in

plugins/deezer/Deezer.ts:112


name

Readonly name: string

The name of the plugin.

Inherited from

Plugin.name

Defined in

src/Plugin.ts:8


ruvyrias

Private ruvyrias: Ruvyrias

Defined in

plugins/deezer/Deezer.ts:113

Methods

buildResponse

buildResponse(loadType, tracks, playlistName?, exceptionMsg?): object

Builds a response object based on the specified parameters.

Parameters

NameTypeDescription
loadTypeloadTypeThe load type of the response.
tracksanyThe tracks associated with the response.
playlistName?stringThe name of the playlist (optional).
exceptionMsg?stringThe exception message (optional).

Returns

object

  • The constructed response object.

Defined in

plugins/deezer/Deezer.ts:400


buildUnresolved

buildUnresolved(track, requester): Promise<Track>

Builds an unresolved track using the provided Deezer track object and requester.

Parameters

NameTypeDescription
trackDeezerTrackThe Deezer track object.
requesteranyThe requester for the track.

Returns

Promise<Track>

  • An unresolved Track instance representing the Deezer track.

Defined in

plugins/deezer/Deezer.ts:367


check

check(url): boolean

Checks if the provided URL matches the Deezer regex pattern.

Parameters

NameTypeDescription
urlstringThe URL to check.

Returns

boolean

  • True if the URL matches the Deezer regex pattern, false otherwise.

Defined in

plugins/deezer/Deezer.ts:134


decodeDeezerShareLink(url): Promise<null | string>

Decodes a Deezer share link to obtain the original URL.

Parameters

NameTypeDescription
urlstringThe Deezer share link to decode.

Returns

Promise<null | string>

  • A promise that resolves to the original URL after decoding the Deezer share link.

Defined in

plugins/deezer/Deezer.ts:336


getAlbum

getAlbum(id, requester): Promise<object | DeezerAlbum>

Retrieves Deezer album tracks based on the album ID and requester.

Parameters

NameTypeDescription
idstringThe ID of the Deezer album.
requesteranyThe requester for the album tracks.

Returns

Promise<object | DeezerAlbum>

  • A promise that resolves to Deezer album tracks based on the album ID.

Defined in

plugins/deezer/Deezer.ts:314


getArtist

getArtist(id, requester): Promise<object | DeezerArtist>

Retrieves information about a Deezer artist based on the provided ID and requester.

Parameters

NameTypeDescription
idstringThe ID of the Deezer artist.
requesteranyThe requester of the artist information.

Returns

Promise<object | DeezerArtist>

  • A promise that resolves to the Deezer artist information.

Defined in

plugins/deezer/Deezer.ts:242


getArtistTracks

getArtistTracks(deezerArtist): Promise<void>

Retrieves additional tracks for a Deezer artist to ensure a comprehensive list.

Parameters

NameTypeDescription
deezerArtistanyThe Deezer artist object containing track information.

Returns

Promise<void>

  • A promise that resolves once additional tracks are loaded.

Defined in

plugins/deezer/Deezer.ts:270


getData

getData(endpoint): Promise<unknown>

Fetches data from the Deezer API based on the specified endpoint.

Parameters

NameTypeDescription
endpointstringThe Deezer API endpoint to retrieve data from.

Returns

Promise<unknown>

  • A promise that resolves to the data fetched from the Deezer API.

Defined in

plugins/deezer/Deezer.ts:355


getPlaylist

getPlaylist(id, requester): Promise<object>

Retrieves information about a Deezer playlist based on the provided ID and requester.

Parameters

NameTypeDescription
idstringThe ID of the Deezer playlist.
requesteranyThe requester of the playlist information.

Returns

Promise<object>

  • A promise that resolves to the Deezer playlist information.

Defined in

plugins/deezer/Deezer.ts:219


getQuerySong

getQuerySong(query, requester): Promise<unknown>

Retrieves Deezer tracks based on a search query and requester.

Parameters

NameTypeDescription
queryanyThe search query.
requesteranyThe requester for the tracks.

Returns

Promise<unknown>

  • A promise that resolves to Deezer tracks based on the search query.

Defined in

plugins/deezer/Deezer.ts:291


getTrack

getTrack(id, requester): Promise<object | DeezerTrack>

Retrieves information about a Deezer track based on the provided ID and requester.

Parameters

NameTypeDescription
idstringThe ID of the Deezer track.
requesteranyThe requester of the track information.

Returns

Promise<object | DeezerTrack>

  • A promise that resolves to the Deezer track information.

Defined in

plugins/deezer/Deezer.ts:196


isDeezerShareLink(url?): boolean

Checks if the provided URL is a Deezer share link.

Parameters

NameTypeDescription
url?stringThe URL to check.

Returns

boolean

  • True if the URL is a Deezer share link, false otherwise.

Defined in

plugins/deezer/Deezer.ts:143


load

load(ruvyrias): Promise<void>

Overrides the load method of the Plugin class, enabling the Deezer plugin to interact with the Ruvyrias instance.

Parameters

NameTypeDescription
ruvyriasRuvyriasThe Ruvyrias instance.

Returns

Promise<void>

Overrides

Plugin.load

Defined in

plugins/deezer/Deezer.ts:123


resolve

resolve(options): Promise<unknown>

Resolves a track, album, playlist, or artist from Deezer based on the provided query, source, and requester.

Parameters

NameTypeDescription
optionsResolveOptionsThe options for resolving a track.

Returns

Promise<unknown>

  • A promise that resolves to the result of the Deezer resolution.

Defined in

plugins/deezer/Deezer.ts:156