rumpelowy
SIASapphire - Imagine a framework
•Created by rumpelowy on 11/4/2023 in #sapphire-support
I have a problem
avatar.js not working
code :
const { Command } = require("@sapphire/framework");
const { MessageAttachment } = require("discord.js");
class AvatarCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: "avatar",
description: "Pobierz avatar użytkownika"
});
}
registerApplicationCommands(registry) {
registry.registerChatInputCommand((command) => {
command
.setName(this.name)
.setDescription(this.description)
.addUserOption((option) =>
option
.setName("user")
.setDescription("Użytkownik do sprawdzenia")
.setRequired(false)
);
});
}
async chatInputRun(interaction) {
const user = interaction.options.getUser("user") || interaction.user;
const avatarURL = user.displayAvatarURL({ format: "png", size: 2048 });
const attachment = new MessageAttachment(avatarURL);
return interaction.reply({
content:
Avatar użytkownika **${user.username}**
,
files: [attachment],
});
}
}
module.exports = {
AvatarCommand,
};6 replies