mrmBot-Matrix/commands
adroitwhiz 3de4858b5a
Clean up image API code paths (#49)
* Document image.js a bit

* Close image.js sockets in all code paths

I'm not sure whether sockets get GC'd when the function returns

* Remove getFormat

It was only called from one place, and the object property names were
quite confusing

* Clean up image.js conditional a bit

I had to write out an entire truth table for this and work it all out
Thinking hard

* Move actual ImageMagick calling into separate file

This gets rid of the weird, brain-melting ouroboros of code that
recurses across threads and processes.

* Reduce amount of getType wrangling

This amounted to an awful lot of dead conditionals after the image
commands were all modified to pass in image types anyway. This has also
led to two different implementations diverging, which causes bugs like
GIF commands applied to non-GIFs erroring instead of providing a
user-friendly message.

* Unify image-runner return type, clarify image type

This allows us to remove the fromAPI parameter from image-runner, and
helps greatly clarify the behavior around image types.

* Deduplicate GIF code, fix "not a GIF" handling

The special "nogif" value is now stored as the image type instead of its
value, as the value must always be a Buffer now--no loosely-typed
shenanigans.
2021-01-09 19:50:29 -06:00
..
8ball.js Added homebrew and emote, added command params to help and a help webpage generator, updated packages/readme 2019-12-05 10:58:46 -06:00
9gag.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
addtweet.js Migrated database to PostgreSQL, updated packages 2020-07-10 12:07:24 -05:00
avatar.js Preliminary DM support, update URLs to point to new repo link 2020-09-01 17:10:19 -05:00
bandicam.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
bird.js Refactored image/embed handling to prepare for something, don't use fuzz with sonic 2020-04-12 14:51:48 -05:00
blur.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
blurple.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
boi.js More music/sound work 2020-07-06 16:39:56 -05:00
boom.js More music/sound work 2020-07-06 16:39:56 -05:00
bruh.js More music/sound work 2020-07-06 16:39:56 -05:00
caption.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
caption2.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
cat.js Refactored image/embed handling to prepare for something, don't use fuzz with sonic 2020-04-12 14:51:48 -05:00
channel.js Added support for using both MongoDB and PostgreSQL, changed image api timeouts, removed all moderation commands 2020-12-17 20:32:19 -06:00
circle.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
count.js Added support for using both MongoDB and PostgreSQL, changed image api timeouts, removed all moderation commands 2020-12-17 20:32:19 -06:00
cowsay.js Added homebrew and emote, added command params to help and a help webpage generator, updated packages/readme 2019-12-05 10:58:46 -06:00
crop.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
dbl.js Added new help command and command metadata, various changes 2019-12-02 14:47:22 -06:00
decode.js *final* final changes 2020-12-29 22:26:45 -06:00
deviantart.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
dice.js Changed image function syntax, improved dice, switched to fs.promises, might have also done other stuff but idk 2020-08-27 21:34:12 -05:00
dog.js Refactored image/embed handling to prepare for something, don't use fuzz with sonic 2020-04-12 14:51:48 -05:00
donate.js Fixed compatibility with Eris 0.13, get patron list dynamically 2020-10-06 10:18:33 -05:00
emote.js Fixed bug with emote, removed admin section from help 2020-01-12 12:27:16 -06:00
encode.js Added homebrew and emote, added command params to help and a help webpage generator, updated packages/readme 2019-12-05 10:58:46 -06:00
eval.js Added initial music commands and category, moved lavalink node config to separate file 2020-07-06 15:19:30 -05:00
exec.js Added initial music commands and category, moved lavalink node config to separate file 2020-07-06 15:19:30 -05:00
explode.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
explosion.js More music/sound work 2020-07-06 16:39:56 -05:00
fakeping.js More music/sound work 2020-07-06 16:39:56 -05:00
fart.js More music/sound work 2020-07-06 16:39:56 -05:00
fbi.js More music/sound work 2020-07-06 16:39:56 -05:00
feedback.js Preliminary DM support, update URLs to point to new repo link 2020-09-01 17:10:19 -05:00
flag.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
flip.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
flop.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
freeze.js Clean up image API code paths (#49) 2021-01-09 19:50:29 -06:00
fullwidth.js Added homebrew and emote, added command params to help and a help webpage generator, updated packages/readme 2019-12-05 10:58:46 -06:00
funky.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
gamexplain.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
globe.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
haah.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
help.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
homebrew.js Heavy work on the image detection code, fixed mention prefixes not being properly registered 2020-10-18 16:53:35 -05:00
hooh.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
hypercam.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
ifunny.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
image.js Preliminary DM support, update URLs to point to new repo link 2020-09-01 17:10:19 -05:00
implode.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
info.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
invert.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
invite.js Fixed bug with emote, added toggle for most dev branding, added version to info 2019-12-09 14:52:33 -06:00
jpeg.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
leak.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
lengthen.js Fixed issue with lengthen, added new activity messages 2020-08-06 14:21:48 -05:00
loop.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
magik.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
mail.js More music/sound work 2020-07-06 16:39:56 -05:00
mc.js Refactored image/embed handling to prepare for something, don't use fuzz with sonic 2020-04-12 14:51:48 -05:00
meme.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
memecenter.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
motivate.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
nowplaying.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
oof.js More music/sound work 2020-07-06 16:39:56 -05:00
pause.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
ping.js Preliminary DM support, update URLs to point to new repo link 2020-09-01 17:10:19 -05:00
pixelate.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
play.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
prefix.js Added support for using both MongoDB and PostgreSQL, changed image api timeouts, removed all moderation commands 2020-12-17 20:32:19 -06:00
qrcreate.js Reverted qrread native module 2020-09-11 15:22:25 -05:00
qrread.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
queue.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
reload.js Added initial music commands and category, moved lavalink node config to separate file 2020-07-06 15:19:30 -05:00
restart.js Added initial music commands and category, moved lavalink node config to separate file 2020-07-06 15:19:30 -05:00
retro.js Refactored image/embed handling to prepare for something, don't use fuzz with sonic 2020-04-12 14:51:48 -05:00
reverse.js Clean up image API code paths (#49) 2021-01-09 19:50:29 -06:00
rps.js Changed some requires 2020-02-19 16:46:50 -06:00
scott.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
screenshot.js Actually made screenshot owner-only, made image API interaction more secure 2020-12-14 12:39:18 -06:00
serverinfo.js Preliminary DM support, update URLs to point to new repo link 2020-09-01 17:10:19 -05:00
sharpen.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
shorten.js Added homebrew and emote, added command params to help and a help webpage generator, updated packages/readme 2019-12-05 10:58:46 -06:00
shutterstock.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
skip.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
slow.js Clean up image API code paths (#49) 2021-01-09 19:50:29 -06:00
snowflake.js Some security fixes 2020-11-20 15:16:52 -06:00
sonic.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
soos.js Clean up image API code paths (#49) 2021-01-09 19:50:29 -06:00
soundreload.js Made image API node chooser sort by job amount instead of CPU usage, added soundreload 2021-01-08 12:08:10 -06:00
spam.js Added initial music commands and category, moved lavalink node config to separate file 2020-07-06 15:19:30 -05:00
speed.js Clean up image API code paths (#49) 2021-01-09 19:50:29 -06:00
spin.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
stats.js Moved gm extensions and lavalink connection to start of ready, removed unused variable in stats 2020-07-02 10:33:27 -05:00
stop.js Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda 2020-12-26 12:17:10 -06:00
stretch.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
swirl.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
tags.js Added support for using both MongoDB and PostgreSQL, changed image api timeouts, removed all moderation commands 2020-12-17 20:32:19 -06:00
tile.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
trump.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
tweet.js Added initial music commands and category, moved lavalink node config to separate file 2020-07-06 15:19:30 -05:00
unfreeze.js Clean up image API code paths (#49) 2021-01-09 19:50:29 -06:00
userinfo.js Added reply support to image detection, added stealth plugin to screenshot, made credits static, more fixes 2020-11-26 09:31:24 -06:00
waaw.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
wall.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
wdt.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
wide.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
wikihow.js Fixed wikihow request URL and headers, removed unnecessary optimization from motivate 2020-06-04 18:18:16 -05:00
winxp.js More music/sound work 2020-07-06 16:39:56 -05:00
woow.js Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
xkcd.js Refactored image/embed handling to prepare for something, don't use fuzz with sonic 2020-04-12 14:51:48 -05:00
youtube.js Some security fixes 2020-11-20 15:16:52 -06:00