How to make a command with two values

So i am trying to make a buy command like;
buy [item] [amount]
but i dont know how to make it detect two different values.
I only know this:
var item = args.slice(0).join(" ");
and it doesnt help me

You can do something like this:

const args = message.content.splice(prefix.length).split(" ").trim;
const command = args[0];

and then run through all of the arguments after the command using a for loop.

I hope this helps!


thank you for the answer!

i wrote

var amount = args.splice(1).join(" “)
var item = args.splice(0).join(” ")

and it worked perfectly

1 Like