简体   繁体   English

如何使用 setimage discord.js 使图像更大

[英]How do i make image bigger using setimage discord.js

I've tried to set images into my embed like this: Embed.setImage(bot.users.cache.get(User.id).displayAvatarURL({dynamic: true}), 200, 200);我试图像这样将图像设置到我的嵌入中: Embed.setImage(bot.users.cache.get(User.id).displayAvatarURL({dynamic: true}), 200, 200); it works perfectly fine, but honestly the image is small when displayed on discord.它工作得很好,但老实说,在 discord 上显示时图像很小。 does anyone know how to make it bigger?有谁知道如何使它更大? I have searched everywhere and couldn't find any docs that tells me how to set it.我到处搜索,找不到任何告诉我如何设置它的文档。 I've seen bots display my avatar bigger than my bot does.我见过机器人显示我的头像比我的机器人更大。

I will be thankful for any answers!我会感谢任何答案!

Well you code either rewrite the image with node-canvas or use the size attribute when getting displayAvatarURL stated here:好吧,您使用 node-canvas 重写图像或在获取此处所述的displayAvatarURL时使用 size 属性:

https://discord.js.org/#/docs/main/stable/typedef/ImageURLOptions https://discord.js.org/#/docs/main/stable/typedef/ImageURLOptions

//if User is a instance of a user class and it's not partial why not 
//just use User.displayAvatarURL() ?
const user = bot.users.cache.get(User.id);
const url = user.displayAvatarURL({ dynamic: true, size: 256});
new MessageEmbed()
   .setImage(url);

From what I have experienced avatars that are usually small ( if the users have a cropped image) the image will be small I used this-根据我所经历的通常很小的化身(如果用户有裁剪的图像),图像会很小,我使用了这个-

.setImage(message.author.displayAvatarURL({size:1024,dynamic:true}))

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM