Added nowplaying alias, update lava-xm-plugin, only require natives when processing images locally, reimplement cache limit
This commit is contained in:
		
							parent
							
								
									3d97811f20
								
							
						
					
					
						commit
						1cafef76d7
					
				
					 6 changed files with 15 additions and 13 deletions
				
			
		| 
						 | 
					@ -11,7 +11,7 @@ lavalink:
 | 
				
			||||||
      twitch: true
 | 
					      twitch: true
 | 
				
			||||||
      vimeo: true
 | 
					      vimeo: true
 | 
				
			||||||
      mixer: true
 | 
					      mixer: true
 | 
				
			||||||
      http: false
 | 
					      http: true
 | 
				
			||||||
      local: true
 | 
					      local: true
 | 
				
			||||||
    bufferDurationMs: 400
 | 
					    bufferDurationMs: 400
 | 
				
			||||||
    youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
 | 
					    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
 | 
					      #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
 | 
					      #retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
 | 
				
			||||||
  plugins:
 | 
					  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"
 | 
					      repository: "https://jitpack.io"
 | 
				
			||||||
    - dependency: "com.github.Topis-Lavalink-Plugins:Topis-Source-Managers-Plugin:v2.0.7"
 | 
					    - dependency: "com.github.Topis-Lavalink-Plugins:Topis-Source-Managers-Plugin:v2.0.7"
 | 
				
			||||||
      repository: "https://jitpack.io"
 | 
					      repository: "https://jitpack.io"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@ class NowPlayingCommand extends MusicCommand {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static description = "Shows the currently playing song";
 | 
					  static description = "Shows the currently playing song";
 | 
				
			||||||
  static aliases = ["playing", "np"];
 | 
					  static aliases = ["playing", "np", "current"];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default NowPlayingCommand;
 | 
					export default NowPlayingCommand;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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.
 | 
					[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
 | 
					!!! 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:
 | 
					First, download the source and move into it:
 | 
				
			||||||
```sh
 | 
					```sh
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ class TimedMap extends Map {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const runningCommands = new TimedMap();
 | 
					export const runningCommands = new TimedMap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*class Cache extends Map {
 | 
					class Cache extends Map {
 | 
				
			||||||
  constructor(values) {
 | 
					  constructor(values) {
 | 
				
			||||||
    super(values);
 | 
					    super(values);
 | 
				
			||||||
    this.maxValues = 2048;
 | 
					    this.maxValues = 2048;
 | 
				
			||||||
| 
						 | 
					@ -26,8 +26,8 @@ export const runningCommands = new TimedMap();
 | 
				
			||||||
    super.set(key, value);
 | 
					    super.set(key, value);
 | 
				
			||||||
    if (this.size > this.maxValues) this.delete(this.keys().next().value);
 | 
					    if (this.size > this.maxValues) this.delete(this.keys().next().value);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}*/
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const prefixCache = new Map();
 | 
					export const prefixCache = new Cache();
 | 
				
			||||||
export const disabledCache = new Map();
 | 
					export const disabledCache = new Cache();
 | 
				
			||||||
export const disabledCmdCache = new Map();
 | 
					export const disabledCmdCache = new Cache();
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
 | 
				
			||||||
const nodeRequire = createRequire(import.meta.url);
 | 
					const nodeRequire = createRequire(import.meta.url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const relPath = `../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`;
 | 
					const relPath = `../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`;
 | 
				
			||||||
const magick = nodeRequire(relPath);
 | 
					const img = nodeRequire(relPath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const enumMap = {
 | 
					const enumMap = {
 | 
				
			||||||
  "forget": 0,
 | 
					  "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));
 | 
					      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.
 | 
					    // 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.
 | 
					    // 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";
 | 
					    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)), "../");
 | 
					      objectWithFixedType.basePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "../");
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
        const result = magick[object.cmd](objectWithFixedType);
 | 
					        const result = img[object.cmd](objectWithFixedType);
 | 
				
			||||||
        const returnObject = {
 | 
					        const returnObject = {
 | 
				
			||||||
          buffer: result.data,
 | 
					          buffer: result.data,
 | 
				
			||||||
          fileExtension: result.type
 | 
					          fileExtension: result.type
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,9 @@ import EventEmitter from "events";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// only requiring this to work around an issue regarding worker threads
 | 
					// only requiring this to work around an issue regarding worker threads
 | 
				
			||||||
const nodeRequire = createRequire(import.meta.url);
 | 
					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`);
 | 
					  nodeRequire(`../../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ImageConnection from "../imageConnection.js";
 | 
					import ImageConnection from "../imageConnection.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue