Invalid interaction application command(discord.js slash commands using WOKCommands)(无效的交互应用命令(discord.js 斜线命令使用 WOKCommands))
问题描述
我正在使用 discord.js 和 WOKCommands 来使用斜杠命令,但是在 Discord 中输入时它给我一个错误无效的交互应用程序命令"
I'm using discord.js and WOKCommands to use slash commands, but when entered in Discord it gives me an error "Invalid interaction application command"
这里是命令的代码:
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
execute(client, message, cmd, args, Discord) {
// 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 **" + message.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);
},
};
只有当我还需要显示主脚本的代码时,这才是命令的代码.我会这样做的.
That is the code for the command only if I need to show the code for the main script as well. I will do so.
推荐答案
你不能在斜杠命令中使用 Message 你需要把它改成
You Can not use Message in Slash Commands You'l Need to change it to
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
}
};
这篇关于无效的交互应用命令(discord.js 斜线命令使用 WOKCommands)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无效的交互应用命令(discord.js 斜线命令使用 WOK


基础教程推荐
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- npm start 错误与 create-react-app 2022-01-01