Replace deprecated image service functions

This commit is contained in:
Essem 2022-01-08 13:26:04 -06:00
parent 6475c91fbc
commit 25e2ac088f
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
4 changed files with 6 additions and 8 deletions

View file

@ -100,16 +100,14 @@ class ImageCommand extends Command {
}
try {
const { buffer, type } = await this.ipc.command("image", { type: "run", obj: magickParams }, true).catch(e => {
throw e;
});
const { buffer, type } = await this.ipc.serviceCommand("image", { type: "run", obj: magickParams }, true, 9000000);
if (type === "nogif" && this.constructor.requiresGIF) return "That isn't a GIF!";
return {
file: Buffer.from(buffer.data),
name: `${this.constructor.command}.${type}`
};
} catch (e) {
if (e === "Job timed out") return "The image is taking too long to process (>=15 minutes), so the job was cancelled. Try using a smaller image.";
if (e === "Job timed out" || e === "Timeout") return "The image is taking too long to process (>=15 minutes), so the job was cancelled. Try using a smaller image.";
if (e.toString().includes("Not connected to image server") || e === "No available servers") return "I can't seem to contact the image servers, they might be down or still trying to start up. Please wait a little bit.";
throw e;
} finally {