Commit graph

706 commits

Author SHA1 Message Date
62346cbae4 Rework image API again, replaced many calls to replace with replaceAll 2021-01-18 14:11:28 -06:00
b2b8fd643a Add proper support for gfycat gifs, attempt to handle image errors "better", added some new activity messages 2021-01-17 20:40:52 -06:00
116ed94ca3 Attempt to fix a crash with pagination reaction removal 2021-01-16 23:46:07 -06:00
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
adroitwhiz
9069ed5a34
Update file-type dependency (#51) 2021-01-09 12:39:19 -06:00
c2bd68263b Made image API node chooser sort by job amount instead of CPU usage, added soundreload 2021-01-08 12:08:10 -06:00
55da0db479 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 2021-01-06 16:10:31 -06:00
7b64c4ca2a Fixed some queue related stuff 2021-01-04 23:19:59 -06:00
85f38042b9 v1.4.1 2021-01-04 21:02:59 -06:00
9f2bd1fecb Make the bot itself get the image file type again 2021-01-04 20:53:34 -06:00
10ee3c6a31 Removed unnecessary message to main thread 2021-01-04 17:33:13 -06:00
87e2e56ef0 Fixed help page generator still attempting to register moderation commands 2021-01-04 14:35:24 -06:00
2a3f84f628 Properly request only the first 1024 bytes when getting image type 2021-01-04 11:10:57 -06:00
dd114e27b5 Added more activity messages, updated packages, allow any public Lavalink instance to be used via the "local" parameter, added clearer error message for API timeouts 2021-01-04 10:29:18 -06:00
9ab13f5389 Added "sphere" as an alias for globe 2021-01-03 12:04:41 -06:00
b94fd6fd89 Merge branch 'adroitwhiz-manage-resources-better' 2021-01-03 11:50:40 -06:00
adroitwhiz
66743d6fa9 Close image API resources instead of forcing exit 2021-01-03 01:13:38 -05:00
be53f8d352 Handle errors properly *and* also hopefully fix the file descriptor issue for real 2021-01-02 23:56:27 -06:00
adroitwhiz
ae32a3f9f1
Initialize cpuLoad to 0 (#46) 2021-01-02 23:02:41 -06:00
87ab7d39d4 Another attempt to fix the EMFILE error, update license for the new year 2021-01-02 22:40:44 -06:00
67ca7d79d0 Fixed events overloading file descriptor limit 2020-12-30 18:46:17 -06:00
c4c358dcd9 Fixed pango test escape issues 2020-12-30 11:37:41 -06:00
5e170c8fe7 v1.4.0 2020-12-29 22:32:49 -06:00
ae1406b518 *final* final changes 2020-12-29 22:26:45 -06:00
3730691ba2 Final fixes 2020-12-29 20:33:51 -06:00
8a2d4e6669 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
7a254a5139 Added load-based api node selection 2020-12-25 20:27:45 -06:00
Tzlil
9ada79d1e5
add parseCommand so it shows me on the esmbot github (#34) 2020-12-25 18:14:10 -06:00
67a7a71547 More docker fixes 2020-12-25 09:47:22 -06:00
0614f41323 Package.json cleanup 2020-12-24 22:43:32 -06:00
b73fd3d91b A couple of dockerfile fixes 2020-12-24 21:32:15 -06:00
elitwo
9febf3f9d2
Ensure npm has access to package.json. (#31)
This is a common issue, and I ran into it while installing esmBot. For me, and probably others npm throws a permissions error while building, and no packages will be installed. Simply chown the package.json to the node:node user, and this will work again.
2020-12-22 17:20:05 -06:00
9b4861ae4a Fixed database stop crash, made playing status use the current bot username 2020-12-18 18:57:41 -06:00
5fa5f21289 Moved database driver-specific code to their own files 2020-12-18 18:50:25 -06:00
d47c7cacbb Changed DB config settings 2020-12-18 16:05:43 -06:00
3594c4d353 Added proper config options for PostgreSQL 2020-12-18 15:42:34 -06:00
873b3f59bc More caching stuff, changed info command a bit 2020-12-18 14:46:59 -06:00
ef945adf09 Added support for using both MongoDB and PostgreSQL, changed image api timeouts, removed all moderation commands 2020-12-17 20:32:19 -06:00
69d8100f23 Actually made screenshot owner-only, made image API interaction more secure 2020-12-14 12:39:18 -06:00
78ae47dbbb Handle API errors more gracefully, fixed sharpen, restrict screenshot to the bot owner 2020-12-14 10:58:31 -06:00
dependabot[bot]
9c496a4984
Bump ini from 1.3.5 to 1.3.8 (#28)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-11 16:47:06 -06:00
a1c24ea30d Allow sound player to start even if some nodes are down, docker maintenance 2020-12-11 16:46:05 -06:00
0566dca06d Some tweaks to music player commands, added loop, renamed existing loop command to unfreeze 2020-12-11 13:52:02 -06:00
df5ed094a8 Updated readme to point to new setup guide 2020-12-08 09:59:57 -06:00
8df322ae04 Added example tweets.json file 2020-12-08 09:39:23 -06:00
620212257d Changed 8MB image embed 2020-12-07 20:42:36 -06:00
Jake Stanger
c6b7e6629c
Add docker-compose file (#27)
* feat: add docker-compose file

* refactor: lower docker-compose version

* feat(docker-compose): add help docs and image dir, fix lavalink

* fix(docker): missing ffmpeg dependency

* fix(docker): compile imagemagick with pango support

This fixes commands such as `meme` causing the bot to crash, since Alpine does not have a pango-enabled version of IM7 in its repos.

* feat(docker): cache npm dependencies

By copying just the `package-(lock).json` and installing dependencies, Docker will cache the deps on subsequent builds.

* fix(docker-compose): need to adjust connection addresses

The MongoDB and Chrome addresses are automatically passed through with the correct value. A separate `servers.json` file specifically for docker-compose is used with the correct container addresses.

Each container has a static ip - this is due to an unfortunate limitation of the Chrome remote debugger, which needs either an IP or `localhost`, and refuses connections to a hostname.

* refactor(docker): do not include servers.json for compose

Compose will use the normal `servers.json` and users will have to change the hostnames to `lavalink` and `api` respectively.
2020-12-07 20:40:17 -06:00
3deb2b4986 Added warning message for Win32, fixed api not getting env data 2020-12-03 10:30:33 -06:00
59dec7f857 Made image functions run on a worker thread when the API is disabled 2020-11-26 11:48:19 -06:00
94b0bc19a4 Added reply support to image detection, added stealth plugin to screenshot, made credits static, more fixes 2020-11-26 09:31:24 -06:00