首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >DiscordAPIError:无法发送带有嵌入的空消息

DiscordAPIError:无法发送带有嵌入的空消息
EN

Stack Overflow用户
提问于 2021-11-16 10:50:28
回答 2查看 145关注 0票数 1

我不想把不和谐的东西埋进去。这是我的密码:

代码语言:javascript
运行
复制
module.exports = {
    name: 'tiktok',
    description: "sends tiktok link",
    execute(message, args, Discord) {
        const newEmbed = new Discord.MessageEmbed()
        .setColor('#228B22')
        .setTitle('Tiktok')
        .setURL('https://www.tiktok.com/@elcattuccino?lang=en')
        .setDescription('tiktok link for the discord server')
        .addFields(
            {name: 'Tiktok', value:'heres the tiktok link'},
        )
        .setImage('https://cdn.discordapp.com/avatars/752212130870329384/6a16609eafc28f95ad8f64e80ffcc24e.png?size=80')
        .setFooter('check out the tiktok');
        
        message.channel.send(newEmbed);
    }
}

但我知道这个错误:

抛出新的DiscordAPIError(数据、res.status、请求);^ Bot\node_modules\discord.js\src\rest\RequestHandler.js:349:13):DiscordAPIError:无法在异步RequestHandler.push (C:\Users\willm\OneDrive\Desktop)的异步RequestHandler.push(节点:内部/进程/任务队列:96:5)发送空消息(C:\Users\willm\OneDrive\Desktop\Discord异步TextChannel.send (C:\Users\willm\OneDrive\Desktop)不和Bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:172:15) {方法:'post',路径:'/channels/910099863180550144/messages', 代码: 50006,httpStatus: 400,requestData:{ json:{内容:未定义,tts: false,undefined,undefined,嵌入:未定义,组件:未定义,用户名:未定义,avatar_url:未定义,allowed_mentions:未定义,标志:未定义,message_reference:未定义,附件:未定义,sticker_ids:未定义},文件:[] }}

EN

回答 2

Stack Overflow用户

发布于 2021-11-16 10:54:47

如果您使用的是discord.js v13,您应该发送这样的嵌入,因为您现在最多可以发送10个嵌入:

代码语言:javascript
运行
复制
message.channel.send({ embeds: [newEmbed] });

嵌入选项被移除并替换为嵌入数组,该数组必须位于options对象中。更多信息

票数 1
EN

Stack Overflow用户

发布于 2021-11-16 16:16:15

使用message.channel.send({ embeds: [newEmbed] });

此外,字段已更改。

像这样的.addField('LINK', '[LINK](TIKTOK LINK)', true)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69987766

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档