mrmBot-Matrix/commands/general/imagestats.js

35 lines
977 B
JavaScript
Raw Normal View History

import Command from "../../classes/command.js";
import { connections } from "../../utils/image.js";
class ImageStatsCommand extends Command {
async run() {
2022-03-22 20:43:26 +00:00
await this.acknowledge();
const embed = {
2021-11-10 04:09:10 +00:00
embeds: [{
"author": {
"name": "esmBot Image Statistics",
"iconURL": this.client.user.avatarURL()
},
"color": 16711680,
"description": `The bot is currently connected to ${connections.size} image server(s).`,
"fields": []
2021-11-10 04:09:10 +00:00
}]
};
let i = 0;
for (const connection of connections.values()) {
const count = await connection.getCount();
if (!count) continue;
2021-11-10 04:09:10 +00:00
embed.embeds[0].fields.push({
name: `Server ${i++}`,
value: `Running Jobs: ${count}`
});
}
return embed;
}
static description = "Gets some statistics about the image servers";
static aliases = ["imgstat", "imstats", "imgstats", "imstat"];
}
export default ImageStatsCommand;