refactor
This commit is contained in:
parent
fbf4a50884
commit
809139782e
3 changed files with 8 additions and 6 deletions
|
@ -34,6 +34,8 @@ $ npm install --save @discordjs/opus
|
||||||
- Lightweight 🛬
|
- Lightweight 🛬
|
||||||
- Custom extractors support 🌌
|
- Custom extractors support 🌌
|
||||||
- Lyrics 📃
|
- Lyrics 📃
|
||||||
|
- Multiple sources support ✌
|
||||||
|
- Play in multiple servers at the same time 🚗
|
||||||
|
|
||||||
# Sources supported
|
# Sources supported
|
||||||
> By default, **discord-player** supports `youtube`, `spotify`, `soundcloud`, `vimeo`, `reverbnation`, `facebook` and `attachment links` only.
|
> By default, **discord-player** supports `youtube`, `spotify`, `soundcloud`, `vimeo`, `reverbnation`, `facebook` and `attachment links` only.
|
||||||
|
|
|
@ -119,7 +119,7 @@ export class Player extends EventEmitter {
|
||||||
const track = new Track(this, {
|
const track = new Track(this, {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
url: data.url,
|
url: data.url,
|
||||||
duration: Util.durationString(Util.parseMS(data.duration / 1000)),
|
duration: Util.buildTimeCode(Util.parseMS(data.duration / 1000)),
|
||||||
description: data.description,
|
description: data.description,
|
||||||
thumbnail: data.thumbnail,
|
thumbnail: data.thumbnail,
|
||||||
views: data.playCount,
|
views: data.playCount,
|
||||||
|
@ -213,7 +213,7 @@ export class Player extends EventEmitter {
|
||||||
new Track(this, {
|
new Track(this, {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
url: data.url,
|
url: data.url,
|
||||||
duration: Util.durationString(Util.parseMS(data.duration)),
|
duration: Util.buildTimeCode(Util.parseMS(data.duration)),
|
||||||
description: data.description,
|
description: data.description,
|
||||||
thumbnail: data.thumbnail?.displayThumbnailURL(),
|
thumbnail: data.thumbnail?.displayThumbnailURL(),
|
||||||
views: data.views,
|
views: data.views,
|
||||||
|
@ -272,7 +272,7 @@ export class Player extends EventEmitter {
|
||||||
const r = new Track(this, {
|
const r = new Track(this, {
|
||||||
title: song.title,
|
title: song.title,
|
||||||
url: song.url,
|
url: song.url,
|
||||||
duration: Util.durationString(Util.parseMS(song.duration / 1000)),
|
duration: Util.buildTimeCode(Util.parseMS(song.duration / 1000)),
|
||||||
description: song.description,
|
description: song.description,
|
||||||
thumbnail: song.thumbnail ?? 'https://soundcloud.com/pwa-icon-192.png',
|
thumbnail: song.thumbnail ?? 'https://soundcloud.com/pwa-icon-192.png',
|
||||||
views: song.playCount ?? 0,
|
views: song.playCount ?? 0,
|
||||||
|
@ -388,7 +388,7 @@ export class Player extends EventEmitter {
|
||||||
author: info.videoDetails.author.name,
|
author: info.videoDetails.author.name,
|
||||||
url: info.videoDetails.video_url,
|
url: info.videoDetails.video_url,
|
||||||
thumbnail: lastThumbnail.url,
|
thumbnail: lastThumbnail.url,
|
||||||
duration: Util.durationString(Util.parseMS(parseInt(info.videoDetails.lengthSeconds) * 1000)),
|
duration: Util.buildTimeCode(Util.parseMS(parseInt(info.videoDetails.lengthSeconds) * 1000)),
|
||||||
views: parseInt(info.videoDetails.viewCount),
|
views: parseInt(info.videoDetails.viewCount),
|
||||||
requestedBy: message.author,
|
requestedBy: message.author,
|
||||||
fromPlaylist: false,
|
fromPlaylist: false,
|
||||||
|
@ -402,7 +402,7 @@ export class Player extends EventEmitter {
|
||||||
track = new Track(this, {
|
track = new Track(this, {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
duration: Util.durationString(Util.parseMS(data.duration)),
|
duration: Util.buildTimeCode(Util.parseMS(data.duration)),
|
||||||
thumbnail: data.thumbnail,
|
thumbnail: data.thumbnail,
|
||||||
author: data.author,
|
author: data.author,
|
||||||
views: data.views,
|
views: data.views,
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class Util {
|
||||||
author: r.channel.name,
|
author: r.channel.name,
|
||||||
url: r.url,
|
url: r.url,
|
||||||
thumbnail: r.thumbnail.displayThumbnailURL(),
|
thumbnail: r.thumbnail.displayThumbnailURL(),
|
||||||
duration: r.durationFormatted,
|
duration: Util.buildTimeCode(Util.parseMS(r.duration)),
|
||||||
views: r.views,
|
views: r.views,
|
||||||
requestedBy: options?.user,
|
requestedBy: options?.user,
|
||||||
fromPlaylist: Boolean(options?.pl),
|
fromPlaylist: Boolean(options?.pl),
|
||||||
|
|
Loading…
Reference in a new issue