lyrics support
This commit is contained in:
parent
e617d8acf3
commit
facdc53755
2 changed files with 27 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { Client, Collection, Snowflake, Collector, Message, VoiceChannel, VoiceState } from 'discord.js';
|
import { Client, Collection, Snowflake, Collector, Message, VoiceChannel, VoiceState } from 'discord.js';
|
||||||
import { PlayerOptions, PlayerProgressbarOptions, QueueFilters } from './types/types';
|
import { LyricsData, PlayerOptions, PlayerProgressbarOptions, QueueFilters } from './types/types';
|
||||||
import Util from './utils/Util';
|
import Util from './utils/Util';
|
||||||
import AudioFilters from './utils/AudioFilters';
|
import AudioFilters from './utils/AudioFilters';
|
||||||
import { Queue } from './Structures/Queue';
|
import { Queue } from './Structures/Queue';
|
||||||
|
@ -853,6 +853,17 @@ export class Player extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets lyrics of a song
|
||||||
|
* @param query Search query
|
||||||
|
*/
|
||||||
|
async lyrics(query: string) {
|
||||||
|
const data = await DP_EXTRACTORS.Lyrics(query);
|
||||||
|
if (Array.isArray(data)) return null;
|
||||||
|
|
||||||
|
return data as LyricsData;
|
||||||
|
}
|
||||||
|
|
||||||
private _handleVoiceStateUpdate(oldState: VoiceState, newState: VoiceState) {
|
private _handleVoiceStateUpdate(oldState: VoiceState, newState: VoiceState) {
|
||||||
const queue = this.queues.find((g) => g.guildID === oldState.guild.id);
|
const queue = this.queues.find((g) => g.guildID === oldState.guild.id);
|
||||||
if (!queue) return;
|
if (!queue) return;
|
||||||
|
|
|
@ -94,3 +94,18 @@ export interface PlayerProgressbarOptions {
|
||||||
queue?: boolean;
|
queue?: boolean;
|
||||||
length?: number;
|
length?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface LyricsData {
|
||||||
|
title: string;
|
||||||
|
id: number;
|
||||||
|
thumbnail: string;
|
||||||
|
image: string;
|
||||||
|
url: string;
|
||||||
|
artist: {
|
||||||
|
name: string;
|
||||||
|
id: number;
|
||||||
|
url: string;
|
||||||
|
image: string;
|
||||||
|
};
|
||||||
|
lyrics?: string;
|
||||||
|
}
|
Loading…
Reference in a new issue