fixed typo
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
18c0b62b48
commit
ce292488d1
1 changed files with 17 additions and 17 deletions
|
@ -1,6 +1,6 @@
|
||||||
const { Listener } = require('discord-akairo');
|
const { Listener } = require('discord-akairo');
|
||||||
const { dailyStats } = require('../../config.json');
|
const { dailyStats } = require('../../config.json');
|
||||||
let serverID = require('../../json/serverID.json');
|
let serverID = require('../../json/serverID.json');
|
||||||
let report = [];
|
let report = [];
|
||||||
let time = new Date();
|
let time = new Date();
|
||||||
|
|
||||||
|
@ -17,16 +17,16 @@ class commandStartedListener extends Listener {
|
||||||
|
|
||||||
//This is for april fools
|
//This is for april fools
|
||||||
let today = new Date(), lastUpdate;
|
let today = new Date(), lastUpdate;
|
||||||
|
|
||||||
let dd = today.getDate();
|
let dd = today.getDate();
|
||||||
let mm = today.getMonth() + 1; //January is 0!
|
let mm = today.getMonth() + 1; //January is 0!
|
||||||
|
|
||||||
if (dd < 10) {
|
if (dd < 10) {
|
||||||
dd = '0' + dd;
|
dd = '0' + dd;
|
||||||
}
|
}
|
||||||
if (mm < 10) {
|
if (mm < 10) {
|
||||||
mm = '0' + mm;
|
mm = '0' + mm;
|
||||||
}
|
}
|
||||||
let curDate = dd + '.' + mm;
|
let curDate = dd + '.' + mm;
|
||||||
//Only execute when its april first
|
//Only execute when its april first
|
||||||
if (curDate === '01.04' && !serverID.includes(message.guild.id)) {
|
if (curDate === '01.04' && !serverID.includes(message.guild.id)) {
|
||||||
|
@ -56,18 +56,18 @@ class commandStartedListener extends Listener {
|
||||||
guild: message.guild.id,
|
guild: message.guild.id,
|
||||||
command: command.id
|
command: command.id
|
||||||
};
|
};
|
||||||
|
|
||||||
report.push(obj);
|
report.push(obj);
|
||||||
|
|
||||||
let uniqueGuild = [];
|
let uniqueGuild = [];
|
||||||
let commands = {};
|
let commands = {};
|
||||||
let executedCommands = 0;
|
let executedCommands = 0;
|
||||||
|
|
||||||
report.forEach(e => {
|
report.forEach(e => {
|
||||||
if (!uniqueGuild.includes(e.guild)) {
|
if (!uniqueGuild.includes(e.guild)) {
|
||||||
uniqueGuild.push(e.guild);
|
uniqueGuild.push(e.guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!commands[e.command]) {
|
if (!commands[e.command]) {
|
||||||
commands[e.command] = 1;
|
commands[e.command] = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,31 +75,31 @@ class commandStartedListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
executedCommands++;
|
executedCommands++;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( !lastUpdate || ( today.getTime() - lastUpdate.getTime() ) > 30000 ) {
|
if ( !lastUpdate || ( today.getTime() - lastUpdate.getTime() ) > 30000 ) {
|
||||||
// Set the last time we checked, and then check if the date has changed.
|
// Set the last time we checked, and then check if the date has changed.
|
||||||
lastUpdate = today;
|
lastUpdate = today;
|
||||||
if ( time.getDate() !== today.getDate() ) {
|
if ( time.getDate() !== today.getDate() ) {
|
||||||
// If the date has changed, set the date to the new date, and refresh stuff.
|
// If the date has changed, set the date to the new date, and refresh stuff.
|
||||||
time = today;
|
time = today;
|
||||||
|
|
||||||
let arr = Object.values(commands);
|
let arr = Object.values(commands);
|
||||||
let max = Math.max(...arr);
|
let max = Math.max(...arr);
|
||||||
let min = Math.min(...arr);
|
let min = Math.min(...arr);
|
||||||
|
|
||||||
let Embed = this.client.util.embed()
|
let Embed = this.client.util.embed()
|
||||||
.setColor('GREEN')
|
.setColor('GREEN')
|
||||||
.setTitle('Daily usage report!')
|
.setTitle('Daily usage report!')
|
||||||
.addField('Number of unique guild', uniqueGuild.length)
|
.addField('Number of unique guild', uniqueGuild.length)
|
||||||
.addField('Number of command exectued', executedCommands, true)
|
.addField('Number of command executed', executedCommands, true)
|
||||||
.addField('Most used command', `${getKeyByValue(commands, max)} (${max} times)`, true )
|
.addField('Most used command', `${getKeyByValue(commands, max)} (${max} times)`, true )
|
||||||
.addField('Least used command', `${getKeyByValue(commands, min)} (${min} times)`, true)
|
.addField('Least used command', `${getKeyByValue(commands, min)} (${min} times)`, true)
|
||||||
.setFooter(`Bot usage as of ${today}`);
|
.setFooter(`Bot usage as of ${today}`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const channel = this.client.channels.resolve(dailyStats);
|
const channel = this.client.channels.resolve(dailyStats);
|
||||||
channel.send(Embed);
|
channel.send(Embed);
|
||||||
|
|
||||||
|
@ -117,4 +117,4 @@ class commandStartedListener extends Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = commandStartedListener;
|
module.exports = commandStartedListener;
|
||||||
|
|
Loading…
Reference in a new issue