I';我制作了一个discord机器人,并试图让代码检查是否有';s请求的嵌入命令中除命令之外的任何内容

I';我制作了一个discord机器人,并试图让代码检查是否有';s请求的嵌入命令中除命令之外的任何内容,discord,discord.js,bots,Discord,Discord.js,Bots,问题是它发送消息,从作者处删除命令消息,不发送嵌入消息 这是我的密码: if (message.content.startsWith(prefix + "embed")) { //embed command; /embed if (!message.content.includes()) { message.delete() message.reply("**You can't embed air**&quo

问题是它发送消息,从作者处删除命令消息,不发送嵌入消息

这是我的密码:

if (message.content.startsWith(prefix + "embed")) { //embed command; /embed
       if (!message.content.includes()) {
           message.delete()
           message.reply("**You can't embed air**")
           return;

           }

           else;
           const embed = new MessageEmbed()
               // Set the title of the field
               .setTitle("Title")
               .setAuthor(message.author.tag)
               // Set the color of the embed
               .setColor(0xff33cc)
               .setFooter("Footer")
               // Set the main content of the embed
               .setDescription(message.content.slice(6, message.content.length));
           // Send the embed to the same channel as the message

           message.channel.send(embed);
       
   } 


非常感谢所有的帮助,甚至我认为我的代码看起来很笨,不应该工作,但谷歌搜索没有帮助,我来了。

只是if-else子句中的一点缩进错误。 此外,.includes将始终返回true,因为所有字符串都包含该字符串“”


这段代码给出了以下命令:(node:19528)UnhandledPromiseRejectionWarning:DiscordAPIError:Unknown message啊,我是哑巴,这与你的答案无关,谢谢你helping@Lauri,一切都好。只是想知道,你做错了什么?
if (message.content.startsWith(prefix + "embed")) { //embed command; /embed
       if (!message.content.replace(prefix+"embed","").includes()) { //makes sure that the content of the embed is not empty 
           message.delete()
           message.reply("**You can't embed air**")
           return;
       }else{
           const embed = new MessageEmbed()
               // Set the title of the field
               .setTitle("Title")
               .setAuthor(message.author.tag)
               // Set the color of the embed
               .setColor(0xff33cc)
               .setFooter("Footer")
               // Set the main content of the embed
               .setDescription(message.content.slice(6, message.content.length));
           // Send the embed to the same channel as the message
           message.channel.send(embed); 
      }