Reputation: 31
How would I make this API for FIVEM
srv.getPlayers().then(data => console.log(data))
log the players' amount to the command I want for example /stats would use that API to show the players when the command is running. sorry if it's a dumb question.
this is what I came up with
client.on('message', message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'stats') {
message.channel.send(srv.getPlayers().then(data));
}
});
Upvotes: 1
Views: 86
Reputation: 2864
try this.
srv.getPlayers().then(data => message.channel.send(data));
Upvotes: 2