{"size": 1660, "ext": "js", "max_stars_repo_path": "src/commands/General/ping.js", "max_stars_repo_name": "barthofu/stockbot-discord", "max_stars_repo_stars_event_min_datetime": "2022-02-04T08:44:02.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-04T08:44:02.000Z", "max_issues_repo_path": "src/commands/General/ping.js", "max_issues_repo_name": "barthofu/stockbot-discord", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/commands/General/ping.js", "max_forks_repo_name": "barthofu/stockbot-discord", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.1228070175, "max_line_length": 186, "alphanum_fraction": 0.5168674699}
const CommandPattern = require("../../models/Command.js");


const commandParams = {
    
    name: "ping",
    aliases: [],
    desc: "Effectue un ping.",
    enabled: true,
    dm: false,
    nsfw: false,
    memberPermission: [],
    botPermission: [],
    owner: false,
    cooldown: null

}

module.exports = class extends CommandPattern {

    constructor () {
        super(commandParams)
    }

    async run (msg, args, cmd, color) {

        let m = await msg.channel.send("〽️ Ping en cours...");
            
        m.edit(new MessageEmbed()
            .setTitle("📶 Ping")
            .setDescription([
                "**Serveur**: `" + (m.createdAt - msg.createdAt) + "ms`",
                "**API**: `" + Math.round(bot.ws.ping) + "ms`",
                "**Uptime**: " + this.msToTime(bot.uptime)
            ].join("\n"))
            .setFooter("Demandé par : " + msg.author.tag, msg.author.displayAvatarURL({dynamic: true}))
            .setColor(color)
            .setTimestamp()
        ).catch(() => m.edit("🆘 Une erreur est survenue."));

    }

    msToTime (ms) {
        let days = Math.floor(ms / (24 * 60 * 60 * 1000));
        let daysms = ms % (24 * 60 * 60 * 1000);
        let hours = Math.floor((daysms) / (60 * 60 * 1000));
        let hoursms = ms % (60 * 60 * 1000);
        let minutes = Math.floor((hoursms) / (60 * 1000));
        let minutesms = ms % (60 * 1000);
        let sec = Math.floor((minutesms) / (1000));

        return `[${days}](https://www.google.com) jours [${hours}](https://www.google.com) heures [${minutes}](https://www.google.com) minutes [${sec}](https://www.google.com) secondes`;
      }

    

}