我正在使用 discord.js 和 WOKCommands 来使用斜杠命令,但是在 Discord 中输入时它给了我一个错误“无效的交互应用程序命令”
这是命令的代码:
cellEditors
仅当我还需要显示主脚本的代码时,这是命令的代码。我会这样做。
答案 0 :(得分:1)
您不能在斜杠命令中使用消息,您需要将其更改为
const { MessageEmbed } = require("discord.js");
// Simple command for the message
module.exports = {
name: "ping",
slash: "both",
testOnly: false,
description: "Command to figure out what your current ping is. Also shows API Latency",
// Executing the message command
callback : ({client, message, cmd, args, Discord}) => {
if (message) {
// Creating the Embed const
const newEmbed = new MessageEmbed()
// ALL EMBED VALUES
.setColor("#ffdbac")
.setTitle("Ping")
.setDescription("Pong! Latency is **" + (Date.now() - message.createdTimestamp) + "ms**. API Latency is **" + client.ws.ping + "ms**")
.setThumbnail(`https://cometiclachlan.github.io/Uploads/pingpong-removebg.png`)
.setTimestamp()
.setFooter("v1.2", `https://cometiclachlan.github.io/Uploads/Checkpoint-removebg.png`);
message.channel.send(newEmbed);
}
// Slash Command
const newEmbed = new MessageEmbed()
...
return newEmbed
}
};