Compare commits
	
		
			No commits in common. "776e4908ba48c6e8283d1356dbc289917245a4b9" and "304f147676b0ed57eadaef982a2a568e5d297f0a" have entirely different histories.
		
	
	
		
			776e4908ba
			...
			304f147676
		
	
		
					 4 changed files with 21 additions and 6 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 204 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 882 KiB  | 
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import Command from "../../classes/command.js";
 | 
			
		|||
class ImageSearchCommand extends Command {
 | 
			
		||||
  async run() {
 | 
			
		||||
    this.success = false;
 | 
			
		||||
    // if (this.channel && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
 | 
			
		||||
    if (this.channel && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
 | 
			
		||||
    const query = this.options.query ?? this.args.join(" ");
 | 
			
		||||
    if (!query || !query.trim()) return "You need to provide something to search for!";
 | 
			
		||||
    // await this.acknowledge();
 | 
			
		||||
| 
						 | 
				
			
			@ -17,10 +17,26 @@ class ImageSearchCommand extends Command {
 | 
			
		|||
    if (rawImages.results.length === 0) return "I couldn't find any results!";
 | 
			
		||||
    const images = rawImages.results.filter((val) => !val.img_src.startsWith("data:"));
 | 
			
		||||
    for (const [i, value] of images.entries()) {
 | 
			
		||||
      return encodeURI(value.img_src)
 | 
			
		||||
      this.success = true;
 | 
			
		||||
      embeds.push({
 | 
			
		||||
        embeds: [{
 | 
			
		||||
          title: "Search Results",
 | 
			
		||||
          color: 16711680,
 | 
			
		||||
          footer: {
 | 
			
		||||
            text: `Page ${i + 1} of ${images.length}`
 | 
			
		||||
          },
 | 
			
		||||
          description: value.title,
 | 
			
		||||
          image: {
 | 
			
		||||
            url: encodeURI(value.img_src)
 | 
			
		||||
          },
 | 
			
		||||
          author: {
 | 
			
		||||
            name: this.author.username,
 | 
			
		||||
            iconURL: this.author.avatarURL()
 | 
			
		||||
          }
 | 
			
		||||
        }]
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    return;
 | 
			
		||||
    this.success = true;
 | 
			
		||||
    return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static flags = [{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -136,8 +136,7 @@ const checkImages = async (message, extraReturnTypes, video, sticker) => {
 | 
			
		|||
      const fileNameNoExtension = message.content.body.slice(0, message.content.body.lastIndexOf("."));
 | 
			
		||||
      type = {name: fileNameNoExtension, path: url, url: url, type: message.content.info.mimetype}
 | 
			
		||||
    }
 | 
			
		||||
  } 
 | 
			
		||||
  if (message.content.msgtype == "m.text") {
 | 
			
		||||
  } else if (message.content.msgtype == "m.text") {
 | 
			
		||||
    let url = message.content.body
 | 
			
		||||
    url = url.replace(/.*\n\n/g, "")
 | 
			
		||||
    if (isValidUrl(url)){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue