小discord.js头像图片

OmG*_*aiL 2 javascript discord discord.js

头像问题示例

在此输入图像描述

我正在尝试执行discord.js avatar 命令并且它有效。它发送需要发送的图像,但问题是发送的图像与其他机器人相比很小。我正在使用discord.js指南中的命令处理程序

const Discord = require('discord.js');
module.exports = {
    name: 'avatar',
    description: 'Get the avatar URL of the tagged user(s), or your own avatar.',
    aliases: ['av', 'a'],
    usage: '[commandname]',
    cooldown: 10,
    execute(message) {
        if (!message.mentions.users.size) {
            const embed = new Discord.MessageEmbed()
                .setTitle(message.author.username)
                .setColor(0x00ffff)
                .setImage(message.author.displayAvatarURL({ format: 'png' }));
            return message.channel.send(embed);
        }

        const mention = message.mentions.members.first();
        const Embed = new Discord.MessageEmbed()
            .setTitle(message.mentions.users.first().username)
            .setColor(0x00ffff)
            .setImage(mention.user.displayAvatarURL({ format: 'png' }));
        return message.channel.send(Embed);

    },
};
Run Code Online (Sandbox Code Playgroud)

小智 6

您可以添加尺寸选项,就像您对格式的处理方式一样

.displayAvatarURL({ format: 'png', size: size_you_want }));
Run Code Online (Sandbox Code Playgroud)

大小为以下 16、32、64、128、256、512、1024、2048、4096 之一,有关详细信息,您可以在此处查看选项https://discord.js.org/#/docs/主要/稳定/typedef/ImageURLOptions