简体   繁体   English

执行歌词命令时出现此错误:DiscordAPIError:无法发送空消息

[英]I have this error when i execute my lyrics command : DiscordAPIError: Cannot send an empty message

Hi can someone help me I have this error when I run my command lyrics: DiscordAPIError: Cannot send an empty message (it's a music bot that uses a command handler) you can contact me on discord: R Λ Z#9217嗨,有人可以帮助我,当我运行命令歌词时出现此错误:DiscordAPIError:无法发送空消息(这是一个使用命令处理程序的音乐机器人)您可以通过 discord 与我联系:R Λ Z#9217

const { MessageEmbed } = require("discord.js");
const lyricsFinder = require("lyrics-finder");

module.exports = {
      name: "lyrics",
    aliases: ['ly'],
    category: "Music",
    description: "View the lyrics of a song",
    args: false,
    usage: "",
    permission: [],
    owner: false,
    player: true,
    inVoiceChannel: true,
    sameVoiceChannel: true,
execute: async (message, args, client, prefix) => {
  
  const player = message.client.manager.get(message.guild.id);
  
  if (!player.queue.current) {
    let thing = new MessageEmbed()
        .setColor("RED")
        .setDescription("There is no music playing.");
    return message.channel.send(thing);
  }

    let lyrics = null;
    const title = player.queue.current
    try {
      lyrics = await lyricsFinder(player.queue.current.title, "");
      if (!lyrics) lyrics = `No lyrics found for ${title}.`, { title: title }
    } catch (error) {
      lyrics = `No lyrics found for ${title}.`, { title: title }
    }

    let lyricsEmbed = new MessageEmbed()
      .setTitle(`${title} - Lyrics`, { title: title })
      .setDescription(`${lyrics}`)
      .setColor("#F8AA2A")
      .setTimestamp();

      if (lyricsEmbed.description.length >= 2048)
      lyricsEmbed.description = `${lyricsEmbed.description.substr(0, 2045)}...`;
      return message.channel.send(lyricsEmbed).catch(console.error);
        
  }
};

Updating to v13 will cause a lot of errors because of breaking changes!更新到 v13 会因为破坏性更改而导致很多错误!
You can find them all listed in the guide right here .您可以在此处的指南中找到所有这些内容。
But in your case, it was about how Discord.js handles parameters with the channel.send() .但在您的情况下,这是关于 Discord.js 如何使用channel.send()处理参数。

 - channel.send(embed);
 + channel.send({ embeds: [embed, embed2] });

 - channel.send('Hello!', { embed });
 + channel.send({ content: 'Hello!', embeds: [embed, embed2] });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我收到此错误,我该如何解决? DiscordAPIError:无法发送空消息 - I got this error, how can i fix? DiscordAPIError: Cannot send an empty message DiscordAPIError:无法发送空消息 - DiscordAPIError: Cannot send an empty message “DiscordAPIError:无法发送空消息” - "DiscordAPIError: Cannot send an empty message" DiscordAPIError:无法在 RequestHandler.execute 发送空消息 - DiscordAPIError: Cannot send an empty message at RequestHandler.execute UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message at RequestHandler.execute - UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message at RequestHandler.execute 我收到错误 DiscordAPIError:无法发送空消息。 在我的一个命令中,昨天完全没问题,我没有改变任何东西 - I'm getting the error DiscordAPIError: Cannot send an empty message. in one of my commands it was completely fine yesterday, I didn't change anything DiscordAPIError:无法发送空消息:我的所有命令? - DiscordAPIError: Cannot send an empty message: all of my commands? Discord bot 的 NodeJS 错误:UnhandledPromiseRejectionWarning:DiscordAPIError:无法发送空消息 - NodeJS error with discord bot: UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message 如何解决:“ DiscordAPIError:无法发送空消息” - How to fix : “DiscordAPIError: Cannot send an empty message” DiscordAPIError:无法发送空消息(Canva) - DiscordAPIError: Cannot send an empty message (Canva)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM