Javascript Discord.js Mineflayer不会获取api json并打印出来

Javascript Discord.js Mineflayer不会获取api json并打印出来,javascript,discord,discord.js,fetch,Javascript,Discord,Discord.js,Fetch,这是我的bot代码,它的意思是将API json的信息发送到ingame聊天中 const ms=require('ms'); 常数fs=要求('fs'); module.exports=async(bot、jsonMsg、position)=>{ //进口 const Discord=require('Discord.js'); const config=require('../conf/config.json');//我的配置文件 const{client}=require('../ind

这是我的bot代码,它的意思是将API json的信息发送到ingame聊天中

const ms=require('ms');
常数fs=要求('fs');
module.exports=async(bot、jsonMsg、position)=>{
//进口
const Discord=require('Discord.js');
const config=require('../conf/config.json');//我的配置文件
const{client}=require('../index.js');//不协调客户端
const fetch=require('node-fetch');//获取皮肤图像的API统计信息
取回(`https://api.mojang.com/users/profiles/minecraft/${(jsonMsg.extra&&jsonMsg.text='Guild>'&&(jsonMsg.extra[1]。text='left.| | | jsonMsg.extra[1]。text='joined.)?jsonMsg.extra[0]。text.replace(/[]/g',):“steve”})
.then(res=>res.json())
。然后(数据=>{
设uuid=data.id?data.id:“8667ba71b85a4004af54457a9734eed7”//如果未找到,则默认为steve skin uuid
const gchannel=client.channels.cache.get('817842919561232445');//公会频道
//连接嵌入
const joinEmbed=new Discord.MessageEmbed()
.setColor(config.MainColor)
.setAuthor(`${jsonMsg.extra?jsonMsg.extra[0]。文本:null}现在联机。``https://crafatar.com/avatars/${uuid}.png`);
//离开嵌入
const leaveEmbed=new Discord.MessageEmbed()
.setColor(config.MainColor)
.setAuthor(`${jsonMsg.extra?jsonMsg.extra[0].text:null}现在脱机。``https://crafatar.com/avatars/${uuid}.png`);
//如果消息以guild开头
if(jsonMsg.text=='Guild>'&&jsonMsg.extra[1]。text=='left'{
gchannel.send(leaveEmbed);
}else if(jsonMsg.text=='Guild>'&&jsonMsg.extra[1]。text=='joined'){
gcchannel.send(joinEmbed);
}
如果(jsonMsg.extra){
如果(jsonMsg.text=''&&jsonMsg.extra[0].text.startsWith('§2Guild>')){
//公会信息有内置的颜色代码,而不是加入信息,所以我们必须去掉这些颜色代码。
让username=jsonMsg.extra?jsonMsg.extra[0]。text.replace(“§2Guild>”,“)。replace(/§7/g)”)。replace(/§f/g.)。replace(/§3/g.)。replace(/§a/g.)。replace(/§6/g.)。replace(/§b/g.)。replace(/§d/,”)。replace(/§c/g.)。replace(/§d/g.))。replace(/§d/g.)。replace(/§e/g.))。replace(/§1/g.)。replace.)替换(/§4/g.)。替换(/§5/g.)。替换(/§8/g.)。替换(/§9/g.)。替换('[VIP]','')。替换('[VIP+]','')。替换('[MVP]','')。替换('[MVP+]','')。替换('[MVP+]','')。替换('[P]','')。替换('[DGD]','')。替换('[GM]','')。替换('[BG,''),'')。替换(';
//获取消息(如果存在)
让msg=jsonMsg.extra?jsonMsg.extra[1]。文本:null;
//检测用户名提取和消息提取是否成功
如果(用户名!==null&&msg!==null){
//用于使用用户名获取播放器的图像uuid
取回(`https://api.mojang.com/users/profiles/minecraft/${username.replace(/[]/g,,)}`)
.then(res=>res.json())
.然后(p=>{
//消息嵌入
const messageEmbed=new Discord.messageEmbed()
.setColor(config.MainColor)
.setAuthor(用户名`https://crafatar.com/avatars/${p.id}.png`)
.setDescription(msg)
.setFooter('Guild bridge man')
.setTimestamp();
gchannel.send(messageEmbed);
})
//在公会内部使用的测试命令
//由“/gc/ping”激活
如果(msg.toLowerCase()='!!ping'){
聊天(`/gc Pong!延迟为${bot.player.ping}ms`);
}
}如果(msg.toLowerCase()=='!requirements'){
bot.chat(“/gc Phazence初级要求:技能平均+CATA等级+(杀戮者XP/10000)=50 |需要不和”);
}
if(msg.toLowerCase().包括(“!bedwars”)){
让arg=msg.replace(“!bedwars”,”);
如果(arg!==null){
取回(`https://api.slothpixel.me/api/players/${arg}`)
.then(data=>data.json())
.然后(p=>{
如果(data.error&&data.error==“玩家不存在”)返回bot.chat(“用户不存在!”);
常量bw=数据['stats']['BedWars'];
聊天(${arg}Bedwars Stars:${bw.level}`);
})
}否则{
聊天(“用户不存在!”);
}
}
}
}
});

}
看起来像一个打字错误;
。然后(p=>{
应该是
。然后(data=>{