update stats/debug
This commit is contained in:
3 files changed
+29
-21
No files matched your search
+16
-2
@@ -13,6 +13,7 @@ class QuarksBot extends Client {
|
||||
this.config = config;
|
||||
this.commands = new Collection();
|
||||
this.logger = new Logger(path.join(__dirname, "..", "logs/Logs.log"));
|
||||
this.commandsRun = 0;
|
||||
|
||||
if (this.config.Token === "")
|
||||
return new TypeError(
|
||||
@@ -28,6 +29,7 @@ class QuarksBot extends Client {
|
||||
this.Ready = false;
|
||||
|
||||
this.ws.on("INTERACTION_CREATE", async (interaction) => {
|
||||
this.commandsRun++;
|
||||
const start = new Date().getTime();
|
||||
if (interaction.type!=3) {
|
||||
client.log("Interaction")
|
||||
@@ -54,7 +56,7 @@ class QuarksBot extends Client {
|
||||
});
|
||||
};
|
||||
let cmd = client.commands.get(command);
|
||||
if (cmd.name == 'ping' && cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start);
|
||||
if ((cmd.name == 'ping' || cmd.name == 'stats') && cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start);
|
||||
else if (cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB });
|
||||
}
|
||||
});
|
||||
@@ -73,7 +75,19 @@ class QuarksBot extends Client {
|
||||
|
||||
exists(n) {return null != n && undefined != n && "" != n}
|
||||
|
||||
padding(data) {return (` ${data}` + " ".repeat((9-data.toString().length)))}
|
||||
secondsToDhms(seconds) {
|
||||
seconds = Number(seconds);
|
||||
const d = Math.floor(seconds / (3600*24));
|
||||
const h = Math.floor(seconds % (3600*24) / 3600);
|
||||
const m = Math.floor(seconds % 3600 / 60);
|
||||
const s = Math.floor(seconds % 60);
|
||||
|
||||
const dDisplay = d > 0 ? d + (d == 1 ? " day, " : " days, ") : "";
|
||||
const hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "";
|
||||
const mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
|
||||
const sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";
|
||||
return dDisplay + hDisplay + mDisplay + sDisplay;
|
||||
}
|
||||
|
||||
LoadCommands() {
|
||||
let CommandsDir = path.join(__dirname, '..', 'commands');
|
||||
|
||||
Reference in new issue
Block a user