Added nowplaying alias, update lava-xm-plugin, only require natives when processing images locally, reimplement cache limit

This commit is contained in:
Essem 2022-08-22 12:44:25 -05:00
parent 3d97811f20
commit 1cafef76d7
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
6 changed files with 15 additions and 13 deletions

View file

@ -11,7 +11,7 @@ lavalink:
twitch: true
vimeo: true
mixer: true
http: false
http: true
local: true
bufferDurationMs: 400
youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
@ -26,7 +26,7 @@ lavalink:
#searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing
#retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
plugins:
- dependency: "com.github.esmBot:lava-xm-plugin:v0.1.0"
- dependency: "com.github.esmBot:lava-xm-plugin:v0.2.0"
repository: "https://jitpack.io"
- dependency: "com.github.Topis-Lavalink-Plugins:Topis-Source-Managers-Plugin:v2.0.7"
repository: "https://jitpack.io"

View file

@ -42,7 +42,7 @@ class NowPlayingCommand extends MusicCommand {
}
static description = "Shows the currently playing song";
static aliases = ["playing", "np"];
static aliases = ["playing", "np", "current"];
}
export default NowPlayingCommand;

View file

@ -46,7 +46,7 @@ Choose the distro you're using below for insallation instructions.
[libvips](https://github.com/libvips/libvips) is the core of esmBot's image processing commands. The latest version (8.13.0) is recommended because it contains fixes to GIF handling and support for the freeze command; however, this version isn't packaged for most distros yet. To fix this, you'll need to build libvips from source.
!!! note
Alpine and Arch users can skip this step, since both distros now have 8.13.0 packaged.
Alpine, Arch, and RHEL **(not Fedora!)** users can skip this step, since these distros now have 8.13.0 packaged.
First, download the source and move into it:
```sh

View file

@ -16,7 +16,7 @@ class TimedMap extends Map {
export const runningCommands = new TimedMap();
/*class Cache extends Map {
class Cache extends Map {
constructor(values) {
super(values);
this.maxValues = 2048;
@ -26,8 +26,8 @@ export const runningCommands = new TimedMap();
super.set(key, value);
if (this.size > this.maxValues) this.delete(this.keys().next().value);
}
}*/
}
export const prefixCache = new Map();
export const disabledCache = new Map();
export const disabledCmdCache = new Map();
export const prefixCache = new Cache();
export const disabledCache = new Cache();
export const disabledCmdCache = new Cache();

View file

@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
const nodeRequire = createRequire(import.meta.url);
const relPath = `../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`;
const magick = nodeRequire(relPath);
const img = nodeRequire(relPath);
const enumMap = {
"forget": 0,
@ -33,7 +33,7 @@ export default function run(object) {
});
promise = request(object.path).then(res => res.body.arrayBuffer()).then(buf => Buffer.from(buf));
}
// Convert from a MIME type (e.g. "image/png") to something ImageMagick understands (e.g. "png").
// Convert from a MIME type (e.g. "image/png") to something the image processor understands (e.g. "png").
// Don't set `type` directly on the object we are passed as it will be read afterwards.
// If no image type is given (say, the command generates its own image), make it a PNG.
const fileExtension = object.params.type ? object.params.type.split("/")[1] : "png";
@ -47,7 +47,7 @@ export default function run(object) {
}
objectWithFixedType.basePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "../");
try {
const result = magick[object.cmd](objectWithFixedType);
const result = img[object.cmd](objectWithFixedType);
const returnObject = {
buffer: result.data,
fileExtension: result.type

View file

@ -11,7 +11,9 @@ import EventEmitter from "events";
// only requiring this to work around an issue regarding worker threads
const nodeRequire = createRequire(import.meta.url);
if (process.env.API_TYPE === "none") {
nodeRequire(`../../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
}
import ImageConnection from "../imageConnection.js";