Handle API errors more gracefully, fixed sharpen, restrict screenshot to the bot owner
This commit is contained in:
parent
9c496a4984
commit
78ae47dbbb
20
api/index.js
20
api/index.js
|
@ -37,10 +37,24 @@ if (isMainThread) {
|
|||
delete jobs[uuid];
|
||||
}
|
||||
});
|
||||
worker.on("error", err => console.error("worker error:", err));
|
||||
worker.on("error", err => {
|
||||
console.error("worker error:", err);
|
||||
socket.send(Buffer.concat([Buffer.from([0x2]), Buffer.from(err.toString())]), jobs[uuid].port, jobs[uuid].addr);
|
||||
|
||||
workingWorkers--;
|
||||
if (queue.length > 0) {
|
||||
acceptJob(queue[0]);
|
||||
delete jobs[uuid];
|
||||
}
|
||||
});
|
||||
worker.on("exit", (code) => {
|
||||
if (code !== 0)
|
||||
console.error(`Worker stopped with exit code ${code}`);
|
||||
workingWorkers--;
|
||||
if (queue.length > 0) {
|
||||
acceptJob(queue[0]);
|
||||
delete jobs[uuid];
|
||||
}
|
||||
|
||||
if (code !== 0) console.error(`Worker stopped with exit code ${code}`);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"libraries": [
|
||||
"<!(pkg-config --libs Magick++)",
|
||||
],
|
||||
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS", "MAGICKCORE_HDRI_ENABLE=false", "MAGICKCORE_QUANTUM_DEPTH=16"]
|
||||
"defines": ["NAPI_CPP_EXCEPTIONS", "MAGICKCORE_HDRI_ENABLE=false", "MAGICKCORE_QUANTUM_DEPTH=16"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -5,7 +5,7 @@ exports.run = async (message) => {
|
|||
const image = await require("../utils/imagedetect.js")(message);
|
||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`;
|
||||
const { buffer, type } = await magick.run({
|
||||
cmd: "sharpen",
|
||||
cmd: "blur",
|
||||
path: image.path,
|
||||
sharp: true
|
||||
});
|
||||
|
|
|
@ -58,7 +58,7 @@ exports.play = async (sound, message, music = false) => {
|
|||
const oldQueue = this.queues.get(voiceChannel.guild.id);
|
||||
if (tracks.length === 0) return `${message.author.mention}, I couldn't find that song!`;
|
||||
if (music) {
|
||||
this.queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, tracks[0].track] : [tracks[0].track]);
|
||||
this.queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, tracks[0].track] : [tracks[0].track]);
|
||||
}
|
||||
let connection;
|
||||
if (player) {
|
||||
|
|
Loading…
Reference in New Issue