fixed img command
This commit is contained in:
parent
b2ecaf9997
commit
8229010545
|
@ -8,7 +8,7 @@ import Command from "../../classes/command.js";
|
||||||
class ImageSearchCommand extends Command {
|
class ImageSearchCommand extends Command {
|
||||||
async run() {
|
async run() {
|
||||||
this.success = false;
|
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(" ");
|
const query = this.options.query ?? this.args.join(" ");
|
||||||
if (!query || !query.trim()) return "You need to provide something to search for!";
|
if (!query || !query.trim()) return "You need to provide something to search for!";
|
||||||
// await this.acknowledge();
|
// await this.acknowledge();
|
||||||
|
@ -17,26 +17,10 @@ class ImageSearchCommand extends Command {
|
||||||
if (rawImages.results.length === 0) return "I couldn't find any results!";
|
if (rawImages.results.length === 0) return "I couldn't find any results!";
|
||||||
const images = rawImages.results.filter((val) => !val.img_src.startsWith("data:"));
|
const images = rawImages.results.filter((val) => !val.img_src.startsWith("data:"));
|
||||||
for (const [i, value] of images.entries()) {
|
for (const [i, value] of images.entries()) {
|
||||||
embeds.push({
|
return encodeURI(value.img_src)
|
||||||
embeds: [{
|
this.success = true;
|
||||||
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()
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.success = true;
|
return;
|
||||||
return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static flags = [{
|
static flags = [{
|
||||||
|
|
Loading…
Reference in New Issue