diff --git a/assets/images/linearexplode.png b/assets/images/linearexplode.png deleted file mode 100644 index af6a163..0000000 Binary files a/assets/images/linearexplode.png and /dev/null differ diff --git a/assets/images/linearimplode.png b/assets/images/linearimplode.png deleted file mode 100644 index fa74de7..0000000 Binary files a/assets/images/linearimplode.png and /dev/null differ diff --git a/commands/general/image.js b/commands/general/image.js index 85d66f2..12acba3 100644 --- a/commands/general/image.js +++ b/commands/general/image.js @@ -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 = [{ diff --git a/utils/imagedetect.js b/utils/imagedetect.js index 99dadf0..6106403 100644 --- a/utils/imagedetect.js +++ b/utils/imagedetect.js @@ -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)){