Attempt to move image processing to an eris-fleet service
This commit is contained in:
parent
736207075b
commit
97050f0cf1
8 changed files with 302 additions and 306 deletions
|
@ -1,21 +1,9 @@
|
|||
const image = require("../../utils/image.js");
|
||||
const logger = require("../../utils/logger.js");
|
||||
const Command = require("../../classes/command.js");
|
||||
|
||||
class ImageReloadCommand extends Command {
|
||||
async run() {
|
||||
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload the image servers!";
|
||||
await image.disconnect();
|
||||
await image.repopulate();
|
||||
let amount = 0;
|
||||
for (const server of image.servers) {
|
||||
try {
|
||||
await image.connect(server);
|
||||
amount += 1;
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
const amount = await this.ipc.command("image", { type: "reload" }, true);
|
||||
if (amount > 0) {
|
||||
return `Successfully connected to ${amount} image servers.`;
|
||||
} else {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const image = require("../../utils/image.js");
|
||||
const Command = require("../../classes/command.js");
|
||||
|
||||
class ImageStatsCommand extends Command {
|
||||
async run() {
|
||||
const servers = await this.ipc.command("image", { type: "stats" }, true);
|
||||
const embed = {
|
||||
embed: {
|
||||
"author": {
|
||||
|
@ -10,11 +10,10 @@ class ImageStatsCommand extends Command {
|
|||
"icon_url": this.client.user.avatarURL
|
||||
},
|
||||
"color": 16711680,
|
||||
"description": `The bot is currently connected to ${image.connections.size} image server(s).`,
|
||||
"description": `The bot is currently connected to ${servers.length} image server(s).`,
|
||||
"fields": []
|
||||
}
|
||||
};
|
||||
const servers = await image.getRunning();
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
embed.embed.fields.push({
|
||||
name: `Server ${i + 1}`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue