[英]JAVASCRIPT How to make API send out a number after using a command
How would I make this API for FIVEM我如何为 FIVEM 制作这个 API
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.将玩家的数量记录到我想要的命令中,例如 /stats 将使用 API 在命令运行时显示玩家。 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));
}
});
try this.尝试这个。
srv.getPlayers().then(data => message.channel.send(data));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.