Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 拾取用户时出错';s阿凡达(discord.js)_Javascript_Node.js_Discord.js - Fatal编程技术网

Javascript 拾取用户时出错';s阿凡达(discord.js)

Javascript 拾取用户时出错';s阿凡达(discord.js),javascript,node.js,discord.js,Javascript,Node.js,Discord.js,代码 错误: 自从我开始使用discord.js V12以来,我一直有很多疑问,其中之一就是,如何捕捉用户的化身?有人能帮我吗?我知道这是一个愚蠢的怀疑,但我真的不知道消息。作者。阿凡达不是一种方法。您需要message.author.avatarURL //作者的化身: .set缩略图(message.author.avatarURL); 如上所述,请尝试使用消息。author.avatar不是一种方法。您需要message.author.avatarURL //作者的化身: .set缩略图

代码

错误:


自从我开始使用discord.js V12以来,我一直有很多疑问,其中之一就是,如何捕捉用户的化身?有人能帮我吗?我知道这是一个愚蠢的怀疑,但我真的不知道

消息。作者。阿凡达
不是一种方法。您需要
message.author.avatarURL

//作者的化身:
.set缩略图(message.author.avatarURL);

如上所述,请尝试使用

消息。author.avatar
不是一种方法。您需要
message.author.avatarURL

//作者的化身:
.set缩略图(message.author.avatarURL);
如上所述,尝试使用discord.js v12中的

//
message.author.displayAvatarURL()
//在discord.js v12中
message.author.displayAvatarURL()

我也遇到了类似的问题。问题是,在获取用户和图像的承诺兑现之前,Discord被发送到了嵌入式系统。这是我用来获取此功能的代码

const client = new Discord.Client();
let thanos = client.users.fetch('IDHERE');
thanos.then(function(result1) {
    //put your code that uses the result1 (the user object) here
    //for example, you could put your entire embed in here and
    //in setFooter you could use result1.displayAvatarURL()
});

我也有类似的问题。问题是,在获取用户和图像的承诺兑现之前,Discord被发送到了嵌入式系统。这是我用来获取此功能的代码

const client = new Discord.Client();
let thanos = client.users.fetch('IDHERE');
thanos.then(function(result1) {
    //put your code that uses the result1 (the user object) here
    //for example, you could put your entire embed in here and
    //in setFooter you could use result1.displayAvatarURL()
});

如果您还不知道discord.js文档。如果您还不知道discord.js文档,请尝试查看那里。试试看那里,
const client = new Discord.Client();
let thanos = client.users.fetch('IDHERE');
thanos.then(function(result1) {
    //put your code that uses the result1 (the user object) here
    //for example, you could put your entire embed in here and
    //in setFooter you could use result1.displayAvatarURL()
});