From 149e73621f3076daa6503b0cf3a60e75c306a2dc Mon Sep 17 00:00:00 2001 From: Trivernis Date: Fri, 18 Jan 2019 19:01:57 +0100 Subject: [PATCH 1/4] Minor music performance changes --- bot.js | 1 + lib/guilding.js | 16 ++++++++++++++++ lib/music.js | 7 +++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bot.js b/bot.js index 0a1464d..09cac10 100644 --- a/bot.js +++ b/bot.js @@ -16,6 +16,7 @@ let presences = [], function main() { utils.Cleanup(() => { + guilding.destroyAll(); client.destroy(); }); cmd.setLogger(logger); diff --git a/lib/guilding.js b/lib/guilding.js index 49ae75e..26f9111 100644 --- a/lib/guilding.js +++ b/lib/guilding.js @@ -33,6 +33,11 @@ exports.GuildHandler = class { this.registerMusicCommands(); } + destroy(){ + this.dj.stop(); + this.db.close(); + } + /** * Creates all tables needed in the Database. * These are at the moment: @@ -299,4 +304,15 @@ exports.GuildHandler = class { exports.getHandler = function (guild, prefix) { if (!handlers[guild.id]) handlers[guild.id] = new this.GuildHandler(guild, prefix); return handlers[guild.id]; +}; + +/** + * Destroy all handlers to safely end all sql3-clients. + */ +exports.destroyAll = function () { + logger.debug('Destroying all handlers...'); + for (let key in Object.keys(handlers)) { + if (handlers[key]) + handlers[key].destroy(); + } }; \ No newline at end of file diff --git a/lib/music.js b/lib/music.js index aa8938f..05984dc 100644 --- a/lib/music.js +++ b/lib/music.js @@ -22,6 +22,7 @@ exports.DJ = class { this.repeat = false; this.volume = 0.5; this.voiceChannel = voiceChannel; + this.quality = 'lowest'; } /** @@ -130,8 +131,10 @@ exports.DJ = class { if (!this.playing || !this.disp) { logger.debug(`Playing ${url}`); this.disp = this.conn.playStream(ytdl(url, { - filter: "audioonly" - }), {seek: 0, volume: this.volume}); + filter: 'audioonly', + quality: this.quality, + liveBuffer: 40000 + }), {volume: this.volume}); this.disp.on('end', (reason) => { if (reason !== 'stop') { this.playing = false; From 2485c3521769f7886d1801934cf3ccf850259da0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 18 Jan 2019 18:24:37 +0000 Subject: [PATCH 2/4] Pin dependency sqlite3 to 4.0.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fa768c..5b68724 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "ffmpeg-binaries": "4.0.0", "get-youtube-title": "1.0.0", "opusscript": "0.0.6", - "sqlite3": "^4.0.6", + "sqlite3": "4.0.6", "winston": "3.1.0", "winston-daily-rotate-file": "3.5.1", "youtube-playlist-info": "1.1.2", From e360e5a15bbd0a81227b4223eca62d6e7b25a5c1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 18 Jan 2019 18:24:39 +0000 Subject: [PATCH 3/4] Update dependency winston-daily-rotate-file to v3.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fa768c..098302d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "opusscript": "0.0.6", "sqlite3": "^4.0.6", "winston": "3.1.0", - "winston-daily-rotate-file": "3.5.1", + "winston-daily-rotate-file": "3.6.0", "youtube-playlist-info": "1.1.2", "ytdl-core": "0.28.3" } From 74d3990a63d0ece2425ffd2f19f0ec6d5cf7e569 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 18 Jan 2019 18:24:42 +0000 Subject: [PATCH 4/4] Update dependency ytdl-core to v0.29.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fa768c..5e051ef 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,6 @@ "winston": "3.1.0", "winston-daily-rotate-file": "3.5.1", "youtube-playlist-info": "1.1.2", - "ytdl-core": "0.28.3" + "ytdl-core": "0.29.1" } }