From fe5a9ccdc2f3086c9995e1a0c493afb515e2064a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hor=C3=A1=C4=8Dek?= Date: Sun, 12 Apr 2020 11:21:38 +0200 Subject: [PATCH 1/2] add joinArguments conf --- commands/play.js | 3 ++- events/message.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/commands/play.js b/commands/play.js index b96db38..e2b33d9 100644 --- a/commands/play.js +++ b/commands/play.js @@ -4,7 +4,8 @@ exports.conf = { aliases: [], permLevel: 'User', requiredPerms: [], - cooldown: 2000 + cooldown: 2000, + joinArguments: 1 } exports.help = { diff --git a/events/message.js b/events/message.js index 2375cb1..1c6da3c 100644 --- a/events/message.js +++ b/events/message.js @@ -106,6 +106,15 @@ module.exports = async (client, message) => { message.flags.push(args.shift().slice(1)) } + let argsPossiblyJoined = args; + + if(cmd.conf.joinArguments) { + if(args.length > cmd.conf.joinArguments && args.length > 1) + { + argsPossiblyJoined[argsLength - 1] = args.slice(argsLength - 1).join(' '); + } + }; + client.logger.log(`Command ran: ${cmd.help.name}`) - cmd.run(client, message, args, level, data) + cmd.run(client, message, argsPossiblyJoined, level, data) } From 8e850b1adf8b444d7ba84e87cbfa9907b81be72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hor=C3=A1=C4=8Dek?= Date: Sun, 12 Apr 2020 11:22:28 +0200 Subject: [PATCH 2/2] fix joinArguments conf --- events/message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/events/message.js b/events/message.js index 1c6da3c..13a46c2 100644 --- a/events/message.js +++ b/events/message.js @@ -111,7 +111,7 @@ module.exports = async (client, message) => { if(cmd.conf.joinArguments) { if(args.length > cmd.conf.joinArguments && args.length > 1) { - argsPossiblyJoined[argsLength - 1] = args.slice(argsLength - 1).join(' '); + argsPossiblyJoined[cmd.conf.joinArguments - 1] = args.slice(cmd.conf.joinArguments - 1).join(' '); } };