MCPcopy Create free account
hub / github.com/esmBot/esmBot / run

Method run

commands/general/raw.js:6–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5class RawCommand extends Command {
6 async run() {
7 await this.acknowledge();
8 const mediaArr = await mediaDetect(this.client, this.permissions, this.message, this.interaction);
9 if (mediaArr.length === 0) {
10 this.success = false;
11 return this.getString("commands.responses.raw.noInput");
12 }
13
14 let final;
15 for (const media of mediaArr) {
16 const type = await request(new URL(media.path), ["image"], true).catch(() => {});
17 if (type) {
18 final = media;
19 break;
20 }
21 }
22 if (!final) return this.getString("image.couldNotFind");
23
24 return final.path;
25 }
26
27 static description = "Gets a direct image URL (useful for saving GIFs from sites like Tenor)";
28 static aliases = ["giflink", "imglink", "getimg", "rawgif", "rawimg"];

Callers

nothing calls this directly

Calls 3

requestFunction · 0.85
acknowledgeMethod · 0.80
getStringMethod · 0.80

Tested by

no test coverage detected