[英]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.