ytdl options

This commit is contained in:
Snowflake107 2021-06-14 20:17:37 +05:45
parent f704f2a82f
commit 7f73e02a60
3 changed files with 7 additions and 4 deletions

View file

@ -18,7 +18,8 @@ const soundcloud = new SoundCloud();
class DiscordPlayer extends EventEmitter<PlayerEvents> {
public readonly client: Client;
public readonly options: DiscordPlayerInitOptions = {
autoRegisterExtractor: true
autoRegisterExtractor: true,
ytdlOptions: {}
};
public readonly queues = new Collection<Snowflake, Queue>();
public readonly voiceUtils = new VoiceUtils();
@ -96,6 +97,7 @@ class DiscordPlayer extends EventEmitter<PlayerEvents> {
const _meta = queueInitOptions.metadata;
delete queueInitOptions["metadata"];
queueInitOptions.ytdlOptions ??= this.options.ytdlOptions
const queue = new Queue(this, guild, queueInitOptions);
queue.metadata = _meta;
this.queues.set(guild.id, queue);

View file

@ -35,7 +35,7 @@ class Queue<T = unknown> {
leaveOnEmptyCooldown: 1000,
autoSelfDeaf: true,
enableLive: false,
ytdlDownloadOptions: {},
ytdlOptions: {},
useSafeSearch: false,
disableAutoRegister: false,
fetchBeforeQueued: false,

View file

@ -1,10 +1,10 @@
import { Snowflake, User } from "discord.js";
import { downloadOptions } from "ytdl-core";
import { Readable, Duplex } from "stream";
import { Queue } from "../Structures/Queue";
import Track from "../Structures/Track";
import { Playlist } from "../Structures/Playlist";
import { StreamDispatcher } from "../VoiceInterface/BasicStreamDispatcher";
import { downloadOptions } from "ytdl-core";
export type FiltersName = keyof QueueFilters;
@ -80,7 +80,7 @@ export interface PlayerOptions {
leaveOnEmptyCooldown?: number;
autoSelfDeaf?: boolean;
enableLive?: boolean;
ytdlDownloadOptions?: downloadOptions;
ytdlOptions?: downloadOptions;
useSafeSearch?: boolean;
disableAutoRegister?: boolean;
fetchBeforeQueued?: boolean;
@ -245,4 +245,5 @@ export interface PlaylistJSON {
export interface DiscordPlayerInitOptions {
autoRegisterExtractor?: boolean;
ytdlOptions?: downloadOptions;
}