ytdl options
This commit is contained in:
parent
f704f2a82f
commit
7f73e02a60
3 changed files with 7 additions and 4 deletions
|
@ -18,7 +18,8 @@ const soundcloud = new SoundCloud();
|
||||||
class DiscordPlayer extends EventEmitter<PlayerEvents> {
|
class DiscordPlayer extends EventEmitter<PlayerEvents> {
|
||||||
public readonly client: Client;
|
public readonly client: Client;
|
||||||
public readonly options: DiscordPlayerInitOptions = {
|
public readonly options: DiscordPlayerInitOptions = {
|
||||||
autoRegisterExtractor: true
|
autoRegisterExtractor: true,
|
||||||
|
ytdlOptions: {}
|
||||||
};
|
};
|
||||||
public readonly queues = new Collection<Snowflake, Queue>();
|
public readonly queues = new Collection<Snowflake, Queue>();
|
||||||
public readonly voiceUtils = new VoiceUtils();
|
public readonly voiceUtils = new VoiceUtils();
|
||||||
|
@ -96,6 +97,7 @@ class DiscordPlayer extends EventEmitter<PlayerEvents> {
|
||||||
|
|
||||||
const _meta = queueInitOptions.metadata;
|
const _meta = queueInitOptions.metadata;
|
||||||
delete queueInitOptions["metadata"];
|
delete queueInitOptions["metadata"];
|
||||||
|
queueInitOptions.ytdlOptions ??= this.options.ytdlOptions
|
||||||
const queue = new Queue(this, guild, queueInitOptions);
|
const queue = new Queue(this, guild, queueInitOptions);
|
||||||
queue.metadata = _meta;
|
queue.metadata = _meta;
|
||||||
this.queues.set(guild.id, queue);
|
this.queues.set(guild.id, queue);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Queue<T = unknown> {
|
||||||
leaveOnEmptyCooldown: 1000,
|
leaveOnEmptyCooldown: 1000,
|
||||||
autoSelfDeaf: true,
|
autoSelfDeaf: true,
|
||||||
enableLive: false,
|
enableLive: false,
|
||||||
ytdlDownloadOptions: {},
|
ytdlOptions: {},
|
||||||
useSafeSearch: false,
|
useSafeSearch: false,
|
||||||
disableAutoRegister: false,
|
disableAutoRegister: false,
|
||||||
fetchBeforeQueued: false,
|
fetchBeforeQueued: false,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Snowflake, User } from "discord.js";
|
import { Snowflake, User } from "discord.js";
|
||||||
import { downloadOptions } from "ytdl-core";
|
|
||||||
import { Readable, Duplex } from "stream";
|
import { Readable, Duplex } from "stream";
|
||||||
import { Queue } from "../Structures/Queue";
|
import { Queue } from "../Structures/Queue";
|
||||||
import Track from "../Structures/Track";
|
import Track from "../Structures/Track";
|
||||||
import { Playlist } from "../Structures/Playlist";
|
import { Playlist } from "../Structures/Playlist";
|
||||||
import { StreamDispatcher } from "../VoiceInterface/BasicStreamDispatcher";
|
import { StreamDispatcher } from "../VoiceInterface/BasicStreamDispatcher";
|
||||||
|
import { downloadOptions } from "ytdl-core";
|
||||||
|
|
||||||
export type FiltersName = keyof QueueFilters;
|
export type FiltersName = keyof QueueFilters;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ export interface PlayerOptions {
|
||||||
leaveOnEmptyCooldown?: number;
|
leaveOnEmptyCooldown?: number;
|
||||||
autoSelfDeaf?: boolean;
|
autoSelfDeaf?: boolean;
|
||||||
enableLive?: boolean;
|
enableLive?: boolean;
|
||||||
ytdlDownloadOptions?: downloadOptions;
|
ytdlOptions?: downloadOptions;
|
||||||
useSafeSearch?: boolean;
|
useSafeSearch?: boolean;
|
||||||
disableAutoRegister?: boolean;
|
disableAutoRegister?: boolean;
|
||||||
fetchBeforeQueued?: boolean;
|
fetchBeforeQueued?: boolean;
|
||||||
|
@ -245,4 +245,5 @@ export interface PlaylistJSON {
|
||||||
|
|
||||||
export interface DiscordPlayerInitOptions {
|
export interface DiscordPlayerInitOptions {
|
||||||
autoRegisterExtractor?: boolean;
|
autoRegisterExtractor?: boolean;
|
||||||
|
ytdlOptions?: downloadOptions;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue