我无法从我的请求中得到响应值。该方法工作正常,但每当我试图将值嵌入时,它都不工作。
代码:
async execute(interaction) {
const ip = interaction.options.getString('server-ip');
const port = interaction.options.getString('port');
util.status(ip, parseInt(port)).then((result) => {
const embed = new EmbedBuilder()
.setThumbnail('attachment://favicon.png')
.setColor('#BFCDEB')
.setTitle('Mc server status')
.addFields(
{ name: 'Players Online', value: online },
{ name: 'Max Player Cap', value: result.players.max },
{ name: 'Server Version', value: result.version.name },
{ name: 'MOTD', value: result.motd.clean },
{
name: 'Ping (from proxies like bungee/waterfall)',
value: result.roundTripLatency,
},
)
.setFooter('MC Server Checker');
});
interaction.channel.send(embed);
}
我尝试将值作为常量获取,但不起作用
1条答案
按热度按时间olhwl3o21#
如果您这样做,它将正常工作:
我只需要把
interaction.channel.send(send)
放进.then()
承诺里