Fix flag command erroring when no flag provided (#67)
This commit is contained in:
		
							parent
							
								
									4842479001
								
							
						
					
					
						commit
						dabf02eb5f
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -7,7 +7,7 @@ exports.run = async (message, args) => {
 | 
			
		|||
  message.channel.sendTyping();
 | 
			
		||||
  const image = await require("../utils/imagedetect.js")(message);
 | 
			
		||||
  if (image === undefined) return `${message.author.mention}, you need to provide an image to overlay a flag onto!`;
 | 
			
		||||
  if (!args[0].match(emojiRegex)) return `${message.author.mention}, you need to provide an emoji of a flag to overlay!`;
 | 
			
		||||
  if (args.length === 0 || !args[0].match(emojiRegex)) return `${message.author.mention}, you need to provide an emoji of a flag to overlay!`;
 | 
			
		||||
  const flag = emoji.unemojify(args[0]).replaceAll(":", "").replace("flag-", "");
 | 
			
		||||
  let path = `./assets/images/region-flags/png/${flag.toUpperCase()}.png`;
 | 
			
		||||
  if (flag === "🏴☠️") path = "./assets/images/pirateflag.png";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue