From 4622f184a38d842ea33ef859c3f728c4e942b42d Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Wed, 12 Jul 2023 14:07:00 +0200 Subject: [PATCH 1/3] fix: update config.json example with player options --- config.json.example | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config.json.example b/config.json.example index 3a53075..30d75d1 100644 --- a/config.json.example +++ b/config.json.example @@ -10,6 +10,17 @@ "colorInfo": "#5865F2", "colorNote": "#80848E" }, + "playerOptions": { + "leaveOnEmpty": true, + "leaveOnEmptyCooldown": 60000, + "leaveOnEnd": true, + "leaveonEndCooldown": 60000, + "leaveOnStop": true, + "leaveOnStopCooldown": 60000, + "defaultVolume": 50, + "maxQueueSize": 1000, + "maxHistorySize": 100 + }, "minimumLogLevel": "debug", "minimumLogLevelConsole": "info", "filterThreadAmount": "4", From 6826feaa100e2a825ec6eca32ee73da357f4afe4 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Wed, 12 Jul 2023 14:08:08 +0200 Subject: [PATCH 2/3] feat: set default player volume to 50%, allow player options to be configured from config --- commands/play.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/commands/play.js b/commands/play.js index 85ed422..d867786 100644 --- a/commands/play.js +++ b/commands/play.js @@ -1,7 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); -const { embedColors } = require('../config.json'); +const { embedColors, playerOptions } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -67,11 +67,15 @@ module.exports = { { requestedBy: interaction.user, nodeOptions: { - leaveOnEmptyCooldown: 60000, - leaveOnEndCooldown: 60000, - leaveOnStopCooldown: 60000, - maxSize: 10000, - maxHistorySize: 100 + leaveOnEmpty: playerOptions.leaveOnEmpty ?? true, + leaveOnEmptyCooldown: playerOptions.leaveOnEmptyCooldown ?? 60000, + leaveOnEnd: playerOptions.leaveOnEnd ?? true, + leaveOnEndCooldown: playerOptions.leaveOnEndCooldown ?? 60000, + leaveOnStop: playerOptions.leaveOnStop ?? true, + leaveOnStopCooldown: playerOptions.leaveOnStopCooldown ?? 60000, + maxSize: playerOptions.maxQueueSize ?? 1000, + maxHistorySize: playerOptions.maxHistorySize ?? 100, + volume: playerOptions.defaultVolume ?? 50 } } ); From 550ec1ac9d1f29c53fa34e99aeee4b9c3f5cb23f Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Wed, 12 Jul 2023 14:08:37 +0200 Subject: [PATCH 3/3] fix: formatting/linting --- commands/play.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/commands/play.js b/commands/play.js index d867786..84f6951 100644 --- a/commands/play.js +++ b/commands/play.js @@ -68,11 +68,14 @@ module.exports = { requestedBy: interaction.user, nodeOptions: { leaveOnEmpty: playerOptions.leaveOnEmpty ?? true, - leaveOnEmptyCooldown: playerOptions.leaveOnEmptyCooldown ?? 60000, + leaveOnEmptyCooldown: + playerOptions.leaveOnEmptyCooldown ?? 60000, leaveOnEnd: playerOptions.leaveOnEnd ?? true, - leaveOnEndCooldown: playerOptions.leaveOnEndCooldown ?? 60000, + leaveOnEndCooldown: + playerOptions.leaveOnEndCooldown ?? 60000, leaveOnStop: playerOptions.leaveOnStop ?? true, - leaveOnStopCooldown: playerOptions.leaveOnStopCooldown ?? 60000, + leaveOnStopCooldown: + playerOptions.leaveOnStopCooldown ?? 60000, maxSize: playerOptions.maxQueueSize ?? 1000, maxHistorySize: playerOptions.maxHistorySize ?? 100, volume: playerOptions.defaultVolume ?? 50