The image API no longer uses a unique thread for each job (due to image processing using its own thread anyway), added dummy DB driver

This commit is contained in:
TheEssem 2021-01-06 16:10:31 -06:00
parent 7b64c4ca2a
commit 55da0db479
4 changed files with 151 additions and 134 deletions

26
utils/database/dummy.js Normal file
View file

@ -0,0 +1,26 @@
// dummy (no-op) database handler
const misc = require("../misc.js");
exports.setup = async () => {};
exports.stop = async () => {};
exports.fixGuild = async () => {};
exports.addCount = async () => {};
exports.getCounts = async () => {
return {};
};
exports.disableChannel = async () => {};
exports.enableChannel = async () => {};
exports.toggleTags = async () => {};
exports.setTag = async () => {};
exports.removeTag = async () => {};
exports.setPrefix = async () => {};
exports.addGuild = async (guild) => {
return {
id: guild.id,
tags: misc.tagDefaults,
prefix: process.env.PREFIX,
disabled: [],
tagsDisabled: false,
};
};
exports.getGuild = exports.addGuild;

View file

@ -66,7 +66,7 @@ const checkImages = async (message) => {
if (message.embeds[0].type === "gifv") {
type = await getImage(message.embeds[0].video.url, message.embeds[0].url, true);
// then we check for other image types
} else if (message.embeds[0].type === "video" || message.embeds[0].type === "image") {
} else if ((message.embeds[0].type === "video" || message.embeds[0].type === "image") && message.embeds[0].thumbnail) {
type = await getImage(message.embeds[0].thumbnail.proxy_url, message.embeds[0].thumbnail.url);
// finally we check both possible image fields for "generic" embeds
} else if (message.embeds[0].type === "rich") {