Added permission check to help, increase image safesearch level
This commit is contained in:
		
							parent
							
								
									7f0f2fb789
								
							
						
					
					
						commit
						f77def1c0e
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -51,6 +51,8 @@ class HelpCommand extends Command {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return embed;
 | 
					      return embed;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					      if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!";
 | 
				
			||||||
 | 
					      if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!";
 | 
				
			||||||
      const pages = [];
 | 
					      const pages = [];
 | 
				
			||||||
      for (const category of Object.keys(help.categories)) {
 | 
					      for (const category of Object.keys(help.categories)) {
 | 
				
			||||||
        const splitPages = help.categories[category].map((item, index) => {
 | 
					        const splitPages = help.categories[category].map((item, index) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ class ImageSearchCommand extends Command {
 | 
				
			||||||
    if (this.args.length === 0) return "You need to provide something to search for!";
 | 
					    if (this.args.length === 0) return "You need to provide something to search for!";
 | 
				
			||||||
    await this.message.channel.sendTyping();
 | 
					    await this.message.channel.sendTyping();
 | 
				
			||||||
    const embeds = [];
 | 
					    const embeds = [];
 | 
				
			||||||
    const images = await fetch(`${random(searx)}/search?format=json&safesearch=1&categories=images&q=!goi%20!bii%20!ddi%20${encodeURIComponent(this.args.join(" "))}`).then(res => res.json());
 | 
					    const images = await fetch(`${random(searx)}/search?format=json&safesearch=2&categories=images&q=!goi%20!bii%20!ddi%20${encodeURIComponent(this.args.join(" "))}`).then(res => res.json());
 | 
				
			||||||
    if (images.results.length === 0) return "I couldn't find any results!";
 | 
					    if (images.results.length === 0) return "I couldn't find any results!";
 | 
				
			||||||
    for (const [i, value] of images.results.entries()) {
 | 
					    for (const [i, value] of images.results.entries()) {
 | 
				
			||||||
      embeds.push({
 | 
					      embeds.push({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue