gpt4 book ai didi

javascript - .sendEmbed 不适用于 RichEmbeds

转载 作者:行者123 更新时间:2023-12-03 03:32:50 25 4
gpt4 key购买 nike

我得到了这个:

( Node :5496)UnhandledPromiseRejectionWarning:未处理的 promise 拒绝(拒绝ID:2):TypeError:无法读取属性rty 'map' of null

( Node :5496)[DEP0018] DeprecationWarning:未处理的 promise 拒绝已被弃用。 future , promise 拒绝未处理的将会以非零退出代码终止 Node.js 进程。

每次我运行“userinfo”命令时

const prefix = require('../../settings.json').prefix;
const Discord = require('discord.js');
const commando = require('discord.js-commando');

class UserInfo extends commando.Command {
constructor(client) {
super(client, {
name: 'userinfo',
group: 'showinfo',
memberName: 'userinfo',
description: 'Muestra la información de un usuario.'
});
}

async run (message, args) {
if(message.author.bot) return;
if(message.channel.type === "dm") return;

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.sendEmbed(embed);
return;
}
}

module.exports = UserInfo;

最佳答案

自 5 月 1 日起,.sendEmbed() 现已弃用。它现在是 .send() 方法的一部分,要发送嵌入,您现在必须输入:

message.channel.send({embed});

enter image description here - https://github.com/hydrabolt/discord.js/releases/tag/11.1.0

所以就你而言,

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});
return;

关于javascript - .sendEmbed 不适用于 RichEmbeds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46009103/

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