avatar command
This commit is contained in:
parent
c33e02e06d
commit
c3490af9d0
2 changed files with 33 additions and 52 deletions
33
bot/commands/Utility/avatar.js
Normal file
33
bot/commands/Utility/avatar.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const Command = require("../../base/Command.js");
|
||||
|
||||
module.exports = class Avatar extends Command {
|
||||
constructor (name, category) {
|
||||
super (name, category)
|
||||
this.name = name,
|
||||
this.description = 'View a full-sized version of someone\'s avatar.',
|
||||
this.options = [
|
||||
{
|
||||
type: 6,
|
||||
name: "user",
|
||||
description: "The user to get the avatar of."
|
||||
},
|
||||
],
|
||||
this.usage = "/avatar [user]"
|
||||
this.friendlyOptions = "`user` - The user to get the avatar of (optional)",
|
||||
this.category = category
|
||||
}
|
||||
|
||||
async run (client, interaction, data) { //eslint-disable-line no-unused-vars
|
||||
const target = await interaction.options.getUser('user') ?? interaction.user;
|
||||
const user = await client.users.fetch(target.id, {force: true})
|
||||
const member = await interaction.guild.members.fetch(target.id, {force: true})
|
||||
|
||||
const embed = new client.EmbedBuilder()
|
||||
.setTitle(user.username + '#' + user.discriminator + "'s avatar")
|
||||
.setColor(user.hexAccentColor ?? member.displayHexColor)
|
||||
.setDescription(`[Global avatar](${user.avatarURL({extension: "png", "size": 4096})})`)
|
||||
.setImage(member.displayAvatarURL({extension: "png", "size": 4096}));
|
||||
|
||||
await interaction.reply({embeds: [embed]});
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue