Fix reddit slash command text input, make filename detection split on last period
This commit is contained in:
		
							parent
							
								
									f3eea0d96a
								
							
						
					
					
						commit
						b0f4c16d50
					
				
					 4 changed files with 8 additions and 3 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB  | 
| 
						 | 
				
			
			@ -10,6 +10,8 @@ class RedditCommand extends ImageCommand {
 | 
			
		|||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static textOptional = true;
 | 
			
		||||
 | 
			
		||||
  static description = "Adds a Reddit watermark to an image";
 | 
			
		||||
  static arguments = ["{text}"];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ class UncannyCommand extends ImageCommand {
 | 
			
		|||
    return {
 | 
			
		||||
      caption: text1?.trim() ? text1.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n") : random(prompts),
 | 
			
		||||
      caption2: text2.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"),
 | 
			
		||||
      path: `./assets/images/uncanny/${typeof this.options.phase === "string" && names.includes(this.options.phase.toLowerCase()) ? this.options.phase.toLowerCase() : random(names)}.png`,
 | 
			
		||||
      path: `./assets/images/uncanny/${typeof this.options.phase === "string" && names.includes(this.options.phase.toLowerCase()) ? this.options.phase.toLowerCase() : random(names.filter((val) => val !== "goated"))}.png`,
 | 
			
		||||
      font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +50,8 @@ class UncannyCommand extends ImageCommand {
 | 
			
		|||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static textOptional = true;
 | 
			
		||||
 | 
			
		||||
  static description = "Makes a Mr. Incredible Becomes Uncanny image (separate left/right text with a comma)";
 | 
			
		||||
  static aliases = ["canny", "incredible", "pain"];
 | 
			
		||||
  static arguments = ["{left text}", "{right text}"];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,11 +39,12 @@ const videoFormats = ["video/mp4", "video/webm", "video/mov"];
 | 
			
		|||
const getImage = async (image, image2, video, extraReturnTypes, gifv = false, type = null, link = false) => {
 | 
			
		||||
  try {
 | 
			
		||||
    const fileNameSplit = new URL(image).pathname.split("/");
 | 
			
		||||
    const fileName = fileNameSplit[fileNameSplit.length - 1].split(".")[0];
 | 
			
		||||
    const fileName = fileNameSplit[fileNameSplit.length - 1];
 | 
			
		||||
    const fileNameNoExtension = fileName.slice(0, fileName.lastIndexOf("."));
 | 
			
		||||
    const payload = {
 | 
			
		||||
      url: image2,
 | 
			
		||||
      path: image,
 | 
			
		||||
      name: fileName
 | 
			
		||||
      name: fileNameNoExtension
 | 
			
		||||
    };
 | 
			
		||||
    const host = new URL(image2).host;
 | 
			
		||||
    if (gifv || (link && combined.includes(host))) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue