volume & invalid streams

This commit is contained in:
Snowflake107 2021-05-31 21:52:34 +05:45
parent ca8e981305
commit 3dfff5feb3
3 changed files with 9 additions and 1 deletions

View file

@ -1133,6 +1133,7 @@ export class Player extends EventEmitter {
if (!channel) return void this.emit(PlayerEvents.ERROR, PlayerErrorEventCodes.NOT_CONNECTED, message, new PlayerError('Voice connection is not available in this server!')); if (!channel) return void this.emit(PlayerEvents.ERROR, PlayerErrorEventCodes.NOT_CONNECTED, message, new PlayerError('Voice connection is not available in this server!'));
const queue = new Queue(this, message); const queue = new Queue(this, message);
queue.volume = this.options.volume || 100;
this.queues.set(message.guild.id, queue); this.queues.set(message.guild.id, queue);
channel channel
@ -1254,6 +1255,8 @@ export class Player extends EventEmitter {
let newStream: any; let newStream: any;
if (!queue.playing?.raw?.source) return void this.emit(PlayerEvents.ERROR, PlayerErrorEventCodes.VIDEO_UNAVAILABLE, queue.firstMessage, queue.playing, new PlayerError('Don\'t know how to play this item', 'PlayerError'));
// modify spotify // modify spotify
if (queue.playing.raw.source === 'spotify' && !(queue.playing as any).backupLink) { if (queue.playing.raw.source === 'spotify' && !(queue.playing as any).backupLink) {
const searchQueryString = this.options.disableArtistSearch ? queue.playing.title : `${queue.playing.title}${' - ' + queue.playing.author}`; const searchQueryString = this.options.disableArtistSearch ? queue.playing.title : `${queue.playing.title}${' - ' + queue.playing.author}`;
@ -1446,6 +1449,7 @@ export default Player;
* @property {Boolean} [disableAutoRegister=false] If it should disable auto-registeration of `@discord-player/extractor` * @property {Boolean} [disableAutoRegister=false] If it should disable auto-registeration of `@discord-player/extractor`
* @property {Boolean} [disableArtistSearch=false] If it should disable artist search for spotify * @property {Boolean} [disableArtistSearch=false] If it should disable artist search for spotify
* @property {Boolean} [fetchBeforeQueued=false] If it should fetch all songs loaded from spotify before playing * @property {Boolean} [fetchBeforeQueued=false] If it should fetch all songs loaded from spotify before playing
* @property {Number} [volume=100] Startup player volume
*/ */
/** /**
@ -1513,6 +1517,8 @@ export default Player;
* @property {Boolean} [timecodes] If it should return progres bar with time codes * @property {Boolean} [timecodes] If it should return progres bar with time codes
* @property {Boolean} [queue] if it should return the progress bar of the whole queue * @property {Boolean} [queue] if it should return the progress bar of the whole queue
* @property {Number} [length] The length of progress bar to build * @property {Number} [length] The length of progress bar to build
* @property {String} [indicator] The progress indicator
* @property {String} [line] The progress bar track
*/ */
/** /**

View file

@ -15,6 +15,7 @@ export interface PlayerOptions {
disableAutoRegister?: boolean; disableAutoRegister?: boolean;
disableArtistSearch?: boolean; disableArtistSearch?: boolean;
fetchBeforeQueued?: boolean; fetchBeforeQueued?: boolean;
volume?: number;
} }
export type FiltersName = keyof QueueFilters; export type FiltersName = keyof QueueFilters;

View file

@ -36,5 +36,6 @@ export const PlayerOptions: DP_OPTIONS = {
leaveOnEmptyCooldown: 0, leaveOnEmptyCooldown: 0,
autoSelfDeaf: true, autoSelfDeaf: true,
enableLive: false, enableLive: false,
ytdlDownloadOptions: {} ytdlDownloadOptions: {},
volume: 100
}; };