This package has been deprecated

Author message:

This package is no longer supported bescause the original author @Skick rewrote the original package and merged beta and alpha branch, if you are using DisTube <= beta33 || alpha18, you can keeping use this package

@arahiko-ayami/spotify
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

@arahiko-ayami/spotify

A DisTube custom plugin for supporting Spotify URL. Forked from @distube/spotify and upgraded to support new Distube >= v3.0.0alpha/beta

Status: beta

Requires DisTube v3.0.0-beta/alpha

Feature

This plugin grabs the songs on Spotify then searches on YouTube and play with DisTube.

Installation

npm install @arahiko-ayami/spotify

Usage

const Discord = require("discord.js");
const DisTube = require("distube");
const SpotifyPlugin = require("@arahiko-ayami/spotify");
const client = new Discord.Client();
const distube = new DisTube(client, {
	searchSongs: 10,
	emitNewSongOnly: true,
	plugins: [new SpotifyPlugin({ parallel: true })],
});

// Now distube.play can play spotify url.

client.on("message", (message) => {
	if (message.author.bot) return;
	if (!message.content.startsWith(config.prefix)) return;
	const args = message.content
		.slice(config.prefix.length)
		.trim()
		.split(/ +/g);
	const command = args.shift();
	if (command === "play") distube.play(message, args.join(" "));
});

Documentation

SpotifyPlugin([options])

  • options.parallel: Default is true. Whether or not searching the playlist in parallel.
  • options.emitPlaySongAfterFetching: Default is false. Emit playSong event before or after fetching all the songs.

    If false, DisTube plays the first song -> emits playSong events -> fetches all the rest
    If true, DisTube plays the first song -> fetches all the rest -> emits playSong events

Package Sidebar

Install

npm i @arahiko-ayami/spotify

Weekly Downloads

1

Version

0.4.2

License

MIT

Unpacked Size

8.36 kB

Total Files

5

Last publish

Collaborators

  • arahiko-ayami