()
| 4 | |
| 5 | class 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"]; |
nothing calls this directly
no test coverage detected