✨ Add music quality option
This commit is contained in:
parent
11acf268d9
commit
6d53e02e74
2 changed files with 6 additions and 1 deletions
|
@ -63,6 +63,7 @@ const filters = {
|
||||||
* @property {boolean} [leaveOnEmpty=true] Whether the bot should leave the voice channel if there is no more member in it.
|
* @property {boolean} [leaveOnEmpty=true] Whether the bot should leave the voice channel if there is no more member in it.
|
||||||
* @property {number} [leaveOnEmptyCooldown=0] Used when leaveOnEmpty is enabled, to let the time to users to come back in the voice channel.
|
* @property {number} [leaveOnEmptyCooldown=0] Used when leaveOnEmpty is enabled, to let the time to users to come back in the voice channel.
|
||||||
* @property {boolean} [autoSelfDeaf=true] Whether the bot should automatically turn off its headphones when joining a voice channel.
|
* @property {boolean} [autoSelfDeaf=true] Whether the bot should automatically turn off its headphones when joining a voice channel.
|
||||||
|
* @property {string} [quality='high'] Music quality (high or low)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +76,8 @@ const defaultPlayerOptions = {
|
||||||
leaveOnStop: true,
|
leaveOnStop: true,
|
||||||
leaveOnEmpty: true,
|
leaveOnEmpty: true,
|
||||||
leaveOnEmptyCooldown: 0,
|
leaveOnEmptyCooldown: 0,
|
||||||
autoSelfDeaf: true
|
autoSelfDeaf: true,
|
||||||
|
quality: 'high'
|
||||||
}
|
}
|
||||||
|
|
||||||
class Player extends EventEmitter {
|
class Player extends EventEmitter {
|
||||||
|
@ -679,6 +681,7 @@ class Player extends EventEmitter {
|
||||||
encoderArgs = ['-af', encoderArgsFilters.join(',')]
|
encoderArgs = ['-af', encoderArgsFilters.join(',')]
|
||||||
}
|
}
|
||||||
const newStream = ytdl(queue.playing.url, {
|
const newStream = ytdl(queue.playing.url, {
|
||||||
|
quality: this.options.quality === 'low' ? 'lowestaudio' : 'highestaudio',
|
||||||
filter: 'audioonly',
|
filter: 'audioonly',
|
||||||
opusEncoded: true,
|
opusEncoded: true,
|
||||||
encoderArgs,
|
encoderArgs,
|
||||||
|
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
|
@ -45,6 +45,7 @@ declare module 'discord-player' {
|
||||||
public once<K extends keyof PlayerEvents>(event: K, listener: (...args: PlayerEvents[K]) => void): this;
|
public once<K extends keyof PlayerEvents>(event: K, listener: (...args: PlayerEvents[K]) => void): this;
|
||||||
public emit<K extends keyof PlayerEvents>(event: K, ...args: PlayerEvents[K]): boolean;
|
public emit<K extends keyof PlayerEvents>(event: K, ...args: PlayerEvents[K]): boolean;
|
||||||
}
|
}
|
||||||
|
type MusicQuality = 'high' | 'low';
|
||||||
interface PlayerOptions {
|
interface PlayerOptions {
|
||||||
leaveOnEnd: boolean;
|
leaveOnEnd: boolean;
|
||||||
leaveOnEndCooldown?: number;
|
leaveOnEndCooldown?: number;
|
||||||
|
@ -52,6 +53,7 @@ declare module 'discord-player' {
|
||||||
leaveOnEmpty: boolean;
|
leaveOnEmpty: boolean;
|
||||||
leaveOnEmptyCooldown?: number;
|
leaveOnEmptyCooldown?: number;
|
||||||
autoSelfDeaf: boolean;
|
autoSelfDeaf: boolean;
|
||||||
|
quality: MusicQuality;
|
||||||
}
|
}
|
||||||
type Filters = 'bassboost' | '8D' | 'vaporwave' | 'nightcore'| 'phaser' | 'tremolo' | 'vibrato' | 'reverse' | 'treble' | 'normalizer' | 'surrounding' | 'pulsator' | 'subboost' | 'karaoke' | 'flanger' | 'gate' | 'haas' | 'mcompand';
|
type Filters = 'bassboost' | '8D' | 'vaporwave' | 'nightcore'| 'phaser' | 'tremolo' | 'vibrato' | 'reverse' | 'treble' | 'normalizer' | 'surrounding' | 'pulsator' | 'subboost' | 'karaoke' | 'flanger' | 'gate' | 'haas' | 'mcompand';
|
||||||
type FiltersStatuses = {
|
type FiltersStatuses = {
|
||||||
|
|
Loading…
Reference in a new issue