Bump packages

This commit is contained in:
Max Isom 2020-10-24 12:32:43 -04:00
parent 4f0ab9b549
commit 599dbce6e6
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
15 changed files with 20134 additions and 6734 deletions

View file

@ -89,7 +89,7 @@ export default class {
}
await handler.execute(msg, args);
} catch (error) {
} catch (error: unknown) {
debug(error);
await msg.channel.send(errorMsg((error as Error).message.toLowerCase()));
}

View file

@ -52,8 +52,8 @@ export default class implements Command {
await player.forwardSeek(seekTime);
await loading.stop();
} catch (error) {
await loading.stop(errorMsg(error));
} catch (error: unknown) {
await loading.stop(errorMsg(error as Error));
}
}
}

View file

@ -2,8 +2,7 @@ import {TextChannel, Message} from 'discord.js';
import {URL} from 'url';
import {TYPES} from '../types';
import {inject, injectable} from 'inversify';
import {QueuedSong} from '../services/player';
import {STATUS} from '../services/player';
import {QueuedSong, STATUS} from '../services/player';
import PlayerManager from '../managers/player';
import {getMostPopularVoiceChannel} from '../utils/channels';
import LoadingMessage from '../utils/loading-message';
@ -111,7 +110,7 @@ export default class implements Command {
newSongs.push(...convertedSongs);
}
} catch (_) {
} catch (_: unknown) {
// Not a URL, must search YouTube
const query = args.join(' ');

View file

@ -63,8 +63,8 @@ export default class implements Command {
await player.seek(seekTime);
await loading.stop();
} catch (error) {
await loading.stop(errorMsg(error));
} catch (error: unknown) {
await loading.stop(errorMsg(error as Error));
}
}
}

View file

@ -32,7 +32,7 @@ export default class implements Command {
await player.forward();
await loader.stop('keep \'er movin\'');
} catch (_) {
} catch (_: unknown) {
await loader.stop(errorMsg('no song to skip to'));
}
}

View file

@ -28,7 +28,7 @@ export default class implements Command {
await player.back();
await msg.channel.send('back \'er up\'');
} catch (_) {
} catch (_: unknown) {
await msg.channel.send(errorMsg('no song to go back to'));
}
}

View file

@ -29,7 +29,7 @@ export default class {
const {items: [video]} = await this.youtube.videos.search({q: query, maxResults: 1, type: 'video'});
return await this.youtubeVideo(video.id.videoId);
} catch (_) {
} catch (_: unknown) {
return null;
}
}
@ -46,7 +46,7 @@ export default class {
playlist: null,
isLive: videoDetails.snippet.liveBroadcastContent === 'live'
};
} catch (_) {
} catch (_: unknown) {
return null;
}
}
@ -200,7 +200,7 @@ export default class {
playlist,
isLive: video.live
};
} catch (_) {
} catch (_: unknown) {
return null;
}
}

View file

@ -84,7 +84,7 @@ export default class {
resolve();
}, duration * 1000);
} catch (error) {
} catch (error: unknown) {
reject(error);
}
});

View file

@ -141,7 +141,7 @@ export default class {
this.startTrackingPosition(0);
this.lastSongURL = currentSong.url;
}
} catch (error) {
} catch (error: unknown) {
this.removeCurrent();
throw error;
}
@ -171,7 +171,7 @@ export default class {
this.status = STATUS.PAUSED;
this.disconnect();
}
} catch (error) {
} catch (error: unknown) {
this.queuePosition--;
throw error;
}
@ -282,7 +282,7 @@ export default class {
await fs.access(this.getCachedPath(url));
return true;
} catch (_) {
} catch (_: unknown) {
return false;
}
}
@ -313,7 +313,7 @@ export default class {
format = formats.find(filter);
const nextBestFormat = (formats: ytdl.videoFormat[]): ytdl.videoFormat | undefined => {
if (formats[0].live) {
if (formats[0].isLive) {
formats = formats.sort((a, b) => (b as unknown as {audioBitrate: number}).audioBitrate - (a as unknown as {audioBitrate: number}).audioBitrate); // Bad typings
return formats.find(format => [128, 127, 120, 96, 95, 94, 93].includes(parseInt(format.itag as unknown as string, 10))); // Bad typings
@ -321,7 +321,13 @@ export default class {
formats = formats
.filter(format => format.averageBitrate)
.sort((a, b) => b.averageBitrate - a.averageBitrate);
.sort((a, b) => {
if (a && b) {
return b.averageBitrate! - a.averageBitrate!;
}
return 0;
});
return formats.find(format => !format.bitrate) ?? formats[0];
};