#level error command

1 messages · Page 1 of 1 (latest)

steady sierra
#

my /level is not working

#

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

nova aspen
#

i would recommend you look up deferring first
since you may not be able to resolve the promise within 3 seconds

bright pikeBOT
steady sierra
#

but i dont use buttons

nova aspen
steady sierra
#

Ah i seee

#

but what is missing

#

Is it deferreply

nova aspen
#

you never showed the code that showed the screenshot either

nova aspen
#

yes but what's er was een.....

#

i don't see that in the code

steady sierra
nova aspen
#

i can't read that language, to me that's just confusing

steady sierra
#

i will translate it

steady sierra