#level error command
1 messages · Page 1 of 1 (latest)
const { SlashCommandBuilder } = require('@discordjs/builders');
const fs = require("fs");
const canvacord = require("canvacord");
const { MessageAttachment } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName('level')
.setDescription('Shows you level!'),
async execute(client, interaction) {
var levelFile = JSON.parse(fs.readFileSync("./Data/levels.js"));
var userID = interaction.user.id;
try {
var nextLevelXP = levelFile[userID].level * 300;
if (nextLevelXP == 0) nextLevelXP == 100;
const rank = new canvacord.Rank()
.setAvatar(interaction.user.displayAvatarURL({ dynamic: false, format: "png" }))
.setCurrentXP(levelFile[userID].xp)
.setLevel(levelFile[userID].level)
.setRequiredXP(nextLevelXP)
.setProgressBar("#FFA500", "COLOR")
.setUsername(interaction.user.username)
.setDiscriminator(interaction.user.discriminator);
rank.build().then(data => {
const attachment = new MessageAttachment(data, "RankCard.png");
interaction.reply({ files: [attachment] });
})
} catch(err){
interaction.reply({ content: "No data found" });
}
}
}
level error command
i would recommend you look up deferring first
since you may not be able to resolve the promise within 3 seconds
where is that
<:_:862626783890636830> discordjs.guide results:
• Interactions: Responding to select menus - Deferring and updating the select menu's message
• Interactions: Responding to buttons - Deferring and updating the button message
but i dont use buttons
bot dumb
https://discordjs.guide/interactions/replying-to-slash-commands.html#deferred-responses this is the guide
you never showed the code that showed the screenshot either
…
That is the code
that is in the index when a error is
i can't read that language, to me that's just confusing
i will translate it
there was a problem executing this command