JaBa/commands/General/avatar.c.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-09-19 23:58:06 +05:00
const { ContextMenuCommandBuilder, ApplicationCommandType, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class AvatarContext extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
*/
constructor() {
super({
command: new ContextMenuCommandBuilder()
2023-11-19 22:43:17 +05:00
.setName("Get Avatar")
.setType(ApplicationCommandType.User)
2024-09-19 23:58:06 +05:00
.setIntegrationTypes([ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall])
2024-09-14 19:52:56 +05:00
.setContexts([InteractionContextType.BotDM, InteractionContextType.PrivateChannel, InteractionContextType.Guild]),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
*/
async execute(client, interaction) {
2024-11-28 10:12:25 +05:00
const avatarURL = interaction.guild ? interaction.targetMember.displayAvatarURL({ dynamic: true, extension: "png", size: 2048 }) : interaction.targetUser.avatarURL({ dynamic: true, extension: "png", size: 2048 });
const embed = client.embed({ image: avatarURL });
interaction.reply({
embeds: [embed],
});
}
}
module.exports = AvatarContext;