const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const { __glob } = require("../modules/global-variables");
const packageJson = require(__glob.PACKAGE);

module.exports = {

    data: new SlashCommandBuilder()
    .setName("about")
    .setDescription("Affiche les informations principales du bot !"),

    async execute(client, interaction) {

        const uptime = process.uptime();
        const hours = Math.floor(uptime / 3600);
        const minutes = Math.floor((uptime % 3600) / 60);
        const seconds = Math.floor(uptime % 60);

        const embed = new EmbedBuilder()
        .setColor(0xb0f542)
        .setThumbnail("https://cdn.discordapp.com/avatars/" + client.user.id + "/" + client.user.avatar + ".png")
        .setTitle('Subsonics - Web')
        .addFields({name: "Version ", value: packageJson.version},{name:"Uptime", value: hours + " heure(s), " +  minutes + " minute(s) et " + seconds + " seconde(s)"},{name: "Ping", value: client.ws.ping + " ms"},{name: "Un bot fait par un fan pour les fans !", value: ":heart:"})
        .setTimestamp();
       
        interaction.reply({embeds: [embed]})
    
    }

}