From 17ae6b2fe778e2de0651b0836dda3fba623e7719 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Wed, 21 Apr 2021 18:02:43 +0545 Subject: [PATCH] add: disableAutoRegister option --- src/Player.ts | 12 ++++++++---- src/types/types.ts | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Player.ts b/src/Player.ts index 21360d3..1455a6d 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -85,9 +85,11 @@ export class Player extends EventEmitter { this.client.on('voiceStateUpdate', (o, n) => void this._handleVoiceStateUpdate(o, n)); // auto detect @discord-player/extractor - let nv: any; - if ((nv = Util.require('@discord-player/extractor'))) { - ['Attachment', 'Facebook', 'Reverbnation', 'Vimeo'].forEach((ext) => void this.use(ext, nv[ext])); + if (!this.options.disableAutoRegister) { + let nv: any; + if ((nv = Util.require('@discord-player/extractor'))) { + ['Attachment', 'Facebook', 'Reverbnation', 'Vimeo'].forEach((ext) => void this.use(ext, nv[ext])); + } } } @@ -903,6 +905,7 @@ export class Player extends EventEmitter { /** * Gets lyrics of a song + * You need to have `@discord-player/extractor` installed in order to use this method! * @param {String} query Search query * @example const lyrics = await player.lyrics("alan walker faded") * message.channel.send(lyrics.lyrics); @@ -1209,7 +1212,7 @@ export class Player extends EventEmitter { } toString() { - return `` + return ``; } } @@ -1332,6 +1335,7 @@ export default Player; * @property {Boolean} [enableLive=false] If it should enable live videos support * @property {YTDLDownloadOptions} [ytdlDownloadOptions={}] The download options passed to `ytdl-core` * @property {Boolean} [useSafeSearch=false] If it should use `safe search` method for youtube searches + * @property {Boolean} [disableAutoRegister=false] If it should disable auto-registeration of `@discord-player/extractor` */ /** diff --git a/src/types/types.ts b/src/types/types.ts index 5be7d34..81ee970 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -12,6 +12,7 @@ export interface PlayerOptions { enableLive?: boolean; ytdlDownloadOptions?: downloadOptions; useSafeSearch?: boolean; + disableAutoRegister?: boolean; } export type FiltersName = keyof QueueFilters;