Compare commits

...

3 Commits

Author SHA1 Message Date
murm 776e4908ba essem is a goober 2023-03-17 00:18:33 -04:00
murm 8229010545 fixed img command 2023-03-17 00:18:24 -04:00
murm b2ecaf9997 fixed url detection 2023-03-17 00:18:14 -04:00
4 changed files with 6 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 KiB

View File

@ -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,26 +17,10 @@ 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()) {
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 encodeURI(value.img_src)
this.success = true;
}
this.success = true;
return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
return;
}
static flags = [{

View File

@ -136,7 +136,8 @@ 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}
}
} else if (message.content.msgtype == "m.text") {
}
if (message.content.msgtype == "m.text") {
let url = message.content.body
url = url.replace(/.*\n\n/g, "")
if (isValidUrl(url)){