简体   繁体   English

当我尝试使用 client.user.setAvatar() 时,没有任何反应

[英]When I try to use client.user.setAvatar(), nothing happens

I am trying to change to bot avatar to a certain user's avatar, but am having trouble.我正在尝试将机器人头像更改为某个用户的头像,但遇到了麻烦。

I tried:我试过了:

client.users.fetch('userid').then((user) => {
    client.user.setAvatar(user.avatarURL());
});

It doesn't work and the avatar doesn't change.它不起作用,头像也不会改变。

Change your code to this:将您的代码更改为:

client.users.fetch('userid').then((user) => {  client.user.setAvatar(user.avatarURL().replace("webp","png");
});

Avatar URL is just the image link.头像 URL 只是图片链接。 Discord CDN can automatically generate image in different format if you change image format in the link itself.如果您更改链接本身的图像格式,Discord CDN 可以自动生成不同格式的图像。 Therefore I did the same above.因此我在上面做了同样的事情。

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

相关问题 当我尝试向我的网站添加反应时没有任何反应,看起来浏览器没有检测到文件 - Nothing happens when I try and add react to my site, it doesn't look like the browser is detecting the file 当我尝试使用此XMLHttpRequest对象加​​载此xml文件时,什么也没有发生 - when i try to load this xml file with this XMLHttpRequest object just nothing happens 当我用Backbone触发事件时没有任何反应 - Nothing happens when I trigger event with Backbone 单击“上传”按钮时没有任何反应 - Nothing happens when I click on the “Upload” button 当我点击按钮时,没有任何反应 - When I click on button, nothing happens 我添加了一个javascript js文件,但是在尝试使用它时,没有任何反应 - I've added a javascript js file but when trying to use it, nothing happens 我将XMLHttpRequest用于菜单,当我请求其中包含javascript的页面HTML时,什么也没发生,为什么? - I use XMLHttpRequest for a menu and when i request a page HTML that contains javascript inside it nothing happens,why? 执行事件时没有任何反应 - Nothing happens when event is executed 单击我的Chrome扩展程序后,什么都没有发生 - Nothing happens when I click my chrome extension JS:为什么当我单击按钮时什么都没发生? - JS: Why when I click the button nothing happens?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM