✨ 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 {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 {string} [quality='high'] Music quality (high or low)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,8 @@ const defaultPlayerOptions = {
|
|||
leaveOnStop: true,
|
||||
leaveOnEmpty: true,
|
||||
leaveOnEmptyCooldown: 0,
|
||||
autoSelfDeaf: true
|
||||
autoSelfDeaf: true,
|
||||
quality: 'high'
|
||||
}
|
||||
|
||||
class Player extends EventEmitter {
|
||||
|
@ -679,6 +681,7 @@ class Player extends EventEmitter {
|
|||
encoderArgs = ['-af', encoderArgsFilters.join(',')]
|
||||
}
|
||||
const newStream = ytdl(queue.playing.url, {
|
||||
quality: this.options.quality === 'low' ? 'lowestaudio' : 'highestaudio',
|
||||
filter: 'audioonly',
|
||||
opusEncoded: true,
|
||||
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 emit<K extends keyof PlayerEvents>(event: K, ...args: PlayerEvents[K]): boolean;
|
||||
}
|
||||
type MusicQuality = 'high' | 'low';
|
||||
interface PlayerOptions {
|
||||
leaveOnEnd: boolean;
|
||||
leaveOnEndCooldown?: number;
|
||||
|
@ -52,6 +53,7 @@ declare module 'discord-player' {
|
|||
leaveOnEmpty: boolean;
|
||||
leaveOnEmptyCooldown?: number;
|
||||
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 FiltersStatuses = {
|
||||
|
|
Loading…
Reference in a new issue