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] 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) }