diff --git a/assets/fonts/twemoji.otf b/assets/fonts/twemoji.otf index 321f355..3ee95fa 100644 Binary files a/assets/fonts/twemoji.otf and b/assets/fonts/twemoji.otf differ diff --git a/classes/imageCommand.js b/classes/imageCommand.js index 2a887a7..632e62f 100644 --- a/classes/imageCommand.js +++ b/classes/imageCommand.js @@ -25,7 +25,8 @@ class ImageCommand extends Command { const imageParams = { cmd: this.constructor.command, - params: {} + params: {}, + id: (this.interaction ?? this.message).id }; if (this.type === "application") await this.acknowledge(); @@ -49,7 +50,6 @@ class ImageCommand extends Command { imageParams.params.type = image.type; imageParams.url = image.url; // technically not required but can be useful for text filtering imageParams.name = image.name; - imageParams.id = (this.interaction ?? this.message).id; if (this.constructor.requiresGIF) imageParams.onlyGIF = true; } catch (e) { runningCommands.delete(this.author.id); diff --git a/events/messageCreate.js b/events/messageCreate.js index e556918..92626ac 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -163,7 +163,9 @@ export default async (client, message) => { file: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`, name: "error.txt" }]); - } catch { /* silently ignore */ } + } catch (e) { + _error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`); + } } } }; diff --git a/natives/caption.cc b/natives/caption.cc index 8741253..2324b43 100644 --- a/natives/caption.cc +++ b/natives/caption.cc @@ -33,10 +33,9 @@ Napi::Value Caption(const Napi::CallbackInfo &info) { int nPages = vips_image_get_n_pages(in.get_image()); int textWidth = width - ((width / 25) * 2); - string font_string = "Twemoji Color Emoji, " + - (font == "roboto" ? "Roboto Condensed" : font) + " " + - (font != "impact" ? "bold" : "normal") + " " + - to_string(size); + string font_string = (font == "roboto" ? "Roboto Condensed" : font) + ", Twemoji Color Emoji " + + (font != "impact" ? "bold" : "normal") + + " " + to_string(size); string captionText = "" + caption + ""; diff --git a/natives/caption2.cc b/natives/caption2.cc index 554cf0c..7b9dd61 100644 --- a/natives/caption2.cc +++ b/natives/caption2.cc @@ -34,9 +34,8 @@ Napi::Value CaptionTwo(const Napi::CallbackInfo &info) { int nPages = vips_image_get_n_pages(in.get_image()); int textWidth = width - ((width / 25) * 2); - string font_string = "Twemoji Color Emoji, " + - (font == "roboto" ? "Roboto Condensed" : font) + " " + - to_string(size); + string font_string = (font == "roboto" ? "Roboto Condensed" : font) + + ", Twemoji Color Emoji " + to_string(size); string captionText = "" + caption + ""; diff --git a/natives/homebrew.cc b/natives/homebrew.cc index 5ac9dd8..eea113b 100644 --- a/natives/homebrew.cc +++ b/natives/homebrew.cc @@ -27,7 +27,7 @@ Napi::Value Homebrew(const Napi::CallbackInfo &info) { VImage::option() ->set("rgba", true) ->set("align", VIPS_ALIGN_CENTRE) - ->set("font", "Twemoji Color Font, PF Square Sans Pro 96") + ->set("font", "PF Square Sans Pro, Twemoji Color Font 96") ->set("fontfile", (basePath + "assets/fonts/twemoji.otf").c_str())); VImage out = bg.composite2(text, VIPS_BLEND_MODE_OVER, diff --git a/natives/meme.cc b/natives/meme.cc index bd14c9a..ed307b8 100644 --- a/natives/meme.cc +++ b/natives/meme.cc @@ -36,10 +36,9 @@ Napi::Value Meme(const Napi::CallbackInfo &info) { int rad = 1; vector zeroVec = {0, 0, 0, 0}; - string font_string = "Twemoji Color Font, " + - (font == "roboto" ? "Roboto Condensed" : font) + " " + - (font != "impact" ? "bold" : "normal") + " " + - to_string(size); + string font_string = (font == "roboto" ? "Roboto Condensed" : font) + ", Twemoji Color Font " + + (font != "impact" ? "bold" : "normal") + + " " + to_string(size); VImage mask = VImage::black(rad * 2 + 1, rad * 2 + 1) + 128; mask.draw_circle({255}, rad, rad, rad, VImage::option()->set("fill", true)); diff --git a/natives/motivate.cc b/natives/motivate.cc index c95c142..48834c2 100644 --- a/natives/motivate.cc +++ b/natives/motivate.cc @@ -35,7 +35,7 @@ Napi::Value Motivate(const Napi::CallbackInfo &info) { int textWidth = width - ((width / 25) * 2); string font_string = - "Twemoji Color Font, " + (font == "roboto" ? "Roboto Condensed" : font); + (font == "roboto" ? "Roboto Condensed" : font) + ", Twemoji Color Font"; auto findResult = fontPaths.find(font); if (findResult != fontPaths.end()) { diff --git a/natives/reddit.cc b/natives/reddit.cc index 26551eb..5a33779 100644 --- a/natives/reddit.cc +++ b/natives/reddit.cc @@ -41,7 +41,7 @@ Napi::Value Reddit(const Napi::CallbackInfo &info) { captionText.c_str(), VImage::option() ->set("rgba", true) - ->set("font", "Twemoji Color Font, Roboto 62") + ->set("font", "Roboto, Twemoji Color Font 62") ->set("fontfile", (basePath + "assets/fonts/twemoji.otf").c_str()) ->set("align", VIPS_ALIGN_LOW)); diff --git a/natives/snapchat.cc b/natives/snapchat.cc index dbf3429..e7e58c7 100644 --- a/natives/snapchat.cc +++ b/natives/snapchat.cc @@ -34,7 +34,7 @@ Napi::Value Snapchat(const Napi::CallbackInfo &info) { int textWidth = width - ((width / 25) * 2); string font_string = - "Twemoji Color Font, Helvetica Neue " + to_string(size); + "Helvetica Neue, Twemoji Color Font " + to_string(size); VImage textIn = VImage::text( ".", VImage::option()->set( diff --git a/natives/sonic.cc b/natives/sonic.cc index ed8d319..a797c6d 100644 --- a/natives/sonic.cc +++ b/natives/sonic.cc @@ -18,16 +18,15 @@ Napi::Value Sonic(const Napi::CallbackInfo &info) { VImage bg = VImage::new_from_file(assetPath.c_str()); VImage textImage = - VImage::text( - ("" + text + "").c_str(), - VImage::option() - ->set("rgba", true) - ->set("align", VIPS_ALIGN_CENTRE) - ->set("font", "Twemoji Color Font, Bitstream Vera Sans") - ->set("fontfile", - (basePath + "assets/fonts/twemoji.otf").c_str()) - ->set("width", 542) - ->set("height", 390)) + VImage::text(("" + text + "").c_str(), + VImage::option() + ->set("rgba", true) + ->set("align", VIPS_ALIGN_CENTRE) + ->set("font", "Verdana, Twemoji Color Font") + ->set("fontfile", + (basePath + "assets/fonts/twemoji.otf").c_str()) + ->set("width", 542) + ->set("height", 390)) .gravity(VIPS_COMPASS_DIRECTION_CENTRE, 542, 390); VImage out = bg.composite2(textImage, VIPS_BLEND_MODE_OVER, diff --git a/natives/uncanny.cc b/natives/uncanny.cc index 5c4388f..758a59f 100644 --- a/natives/uncanny.cc +++ b/natives/uncanny.cc @@ -30,8 +30,7 @@ Napi::Value Uncanny(const Napi::CallbackInfo &info) { VImage base = VImage::black(1280, 720, VImage::option()->set("bands", 3)); - string font_string = "Twemoji Color Font, " + - (font == "roboto" ? "Roboto Condensed" : font) + " " + + string font_string = (font == "roboto" ? "Roboto Condensed" : font) + ", Twemoji Color Font " + (font != "impact" ? "bold" : "normal") + " 72"; string captionText = "" + diff --git a/natives/whisper.cc b/natives/whisper.cc index ecf0b05..b8b0426 100644 --- a/natives/whisper.cc +++ b/natives/whisper.cc @@ -32,7 +32,7 @@ Napi::Value Whisper(const Napi::CallbackInfo &info) { int dividedWidth = width / 175; int rad = 1; - string font_string = "Twemoji Color Font, Upright " + to_string(size); + string font_string = "Upright, Twemoji Color Font " + to_string(size); VImage mask; if (dividedWidth >= 1) { diff --git a/utils/misc.js b/utils/misc.js index cc831a3..8b9f697 100644 --- a/utils/misc.js +++ b/utils/misc.js @@ -28,7 +28,8 @@ export function clean(text) { .replaceAll("`", `\`${String.fromCharCode(8203)}`) .replaceAll("@", `@${String.fromCharCode(8203)}`); - const { parsed } = config(); + let { parsed } = config(); + if (!parsed) parsed = process.env; const imageServers = JSON.parse(fs.readFileSync(new URL("../config/servers.json", import.meta.url), { encoding: "utf8" })).image; if (imageServers?.length !== 0) {