I have a commandArray.json file with 300+ comands+imagelinks in the format commandArray[name][response]
I used the code bellow to show users the command names, but its seems i've reached the discord limit of 2000 characters in a single chat message. So I'm thinking of sending about 100 command names at a time.
Can you help me implement somekind of loop that achieves this?
The code first splits the names and turns the json objects into string and then sorts alphabetically and joins in a string to send the message.
I just need to count 100 names and then send message, and it there are more count again and send and so on.
const commandArray = require("./commandArray.json");
if (message.content === '!commands') {
var addedCommands = commandArray.map(x => `\`${x.name}\``).join(", ")
var stringArray = addedCommands.split(',');
var arrangedString = stringArray.sort().join(", ");
message.channel.send(arrangedString);
}