I have been trying to look through so many different types of tutorial for this but nothing I do seems to be working. For my discord bot I created a json file that houses the following object
{"trainer":[{"name":"Bob","C0":45,"C1":84,"C2":147},
{"name":"Paul","C0":60,"C1":104,"C2":167}],
"prefix":!
}
Now I am trying to figure out how I can make a command so if someone types in !trainer Bob I want the bot display the values for CO, C1, and C2
At the moment I have the following:
const args = message.content.slice(X.prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
X is the name of the json file. the following is where I get stuck
if(command === "trainer"){
message.channel.send('WHAT DO I PUT HERE?')
}
Now I am very new to this all, but if my understanding is correct, my argument 0 is trainer in this case, so what I would like is to use my first argument (which would be the name after !trainer) to link back to the array in my json file so that I can get the other values in the array. Now what I am thinking of doing is creating a const with Shift(1) so that const holds my first argument, but I am still not sure how to use that to get the information from the array. Any guidance on this would be greatly appreciated!