Compare commits
3 commits
304f147676
...
776e4908ba
Author | SHA1 | Date | |
---|---|---|---|
|
776e4908ba | ||
|
8229010545 | ||
|
b2ecaf9997 |
4 changed files with 6 additions and 21 deletions
BIN
assets/images/linearexplode.png
Normal file
BIN
assets/images/linearexplode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 204 KiB |
BIN
assets/images/linearimplode.png
Normal file
BIN
assets/images/linearimplode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 882 KiB |
|
@ -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 = [{
|
||||||
|
|
|
@ -136,7 +136,8 @@ const checkImages = async (message, extraReturnTypes, video, sticker) => {
|
||||||
const fileNameNoExtension = message.content.body.slice(0, message.content.body.lastIndexOf("."));
|
const fileNameNoExtension = message.content.body.slice(0, message.content.body.lastIndexOf("."));
|
||||||
type = {name: fileNameNoExtension, path: url, url: url, type: message.content.info.mimetype}
|
type = {name: fileNameNoExtension, path: url, url: url, type: message.content.info.mimetype}
|
||||||
}
|
}
|
||||||
} else if (message.content.msgtype == "m.text") {
|
}
|
||||||
|
if (message.content.msgtype == "m.text") {
|
||||||
let url = message.content.body
|
let url = message.content.body
|
||||||
url = url.replace(/.*\n\n/g, "")
|
url = url.replace(/.*\n\n/g, "")
|
||||||
if (isValidUrl(url)){
|
if (isValidUrl(url)){
|
||||||
|
|
Loading…
Reference in a new issue