Export command leaderboard every 30 minutes

This commit is contained in:
Dragon Fire
2020-06-06 15:49:31 -04:00
parent 63293a24cf
commit cd287e44be
4 changed files with 36 additions and 12 deletions
+15
View File
@@ -54,4 +54,19 @@ module.exports = class XiaoClient extends CommandoClient {
}
return file;
}
exportCommandLeaderboard() {
let text = '{';
for (const command of this.registry.commands.values()) {
if (command.uses === undefined) continue;
text += `"${command.name}":${command.uses},`;
}
text = text.slice(0, -1);
text += '}';
const buf = Buffer.from(text);
fs.writeFileSync(path.join(__dirname, '..', 'command-leaderboard.json'), buf, {
encoding: 'utf8'
});
return buf;
}
};