gpt4 book ai didi

javascript - 如何修复 RichEmbed?

转载 作者:行者123 更新时间:2023-11-28 03:05:05 25 4
gpt4 key购买 nike

我试图在不和谐中打印获取嵌入消息,但发生了这种情况:

TypeError: Discord.RichEmbed is not a constructor

这是我的代码:

const Discord = require('discord.js');
const bot = new Discord.Client();
const token = 'mytokenhere';
const prefix = '!';

bot.on('ready', () => {
console.log('This bot is online!');
});

bot.on('message', message => {
let args = message.content.substring(prefix.length).split(" ");

switch(args[0]) {
case 'pomoc':
message.channel.send('.')
break;
case 'cc':
if(!args[1]) return message.reply('Podaj 2 argument! (liczbe wiadomosci do skasowania)')
message.channel.bulkDelete(args[1]);
break;
case 'embed':
var embed = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setDescription("Usuario rikolino.")
.setColor("#3535353")
.addField("Usuario", '${message.author.username}#${message.author.discriminator}')
.addField("ID", message.author.id)
.addField("Creación", message.author.createdAt);

message.channel.send({embed});
break;
}
});

bot.login(token);

我尝试了很多其他的解决方案,但结果总是一样,我真的不知道问题出在哪里。

最佳答案

Discord.js

discord.js 已从 new Discord.RichEmbed() 更新了 new Discord.MessageEmbed()

const embed = new Discord.MessageEmbed()
.setAuthor(message.author.username)
.setDescription("Usuario rikolino.")
.setColor("#3535353")
.addField("Usuario", '${message.author.username}#${message.author.discriminator}')
.addField("ID", message.author.id)
.addField("Creación", message.author.createdAt);

message.channel.send(embed);

关于javascript - 如何修复 RichEmbed?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60684028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com