2021-04-23 01:54:26 +00:00
|
|
|
import yiff from "../../utils/yiff"
|
|
|
|
import Command from "../../handler/structures/Command"
|
|
|
|
import { Context } from "../../utils/types";
|
|
|
|
import { MessageEmbed } from "discord.js"
|
|
|
|
import lingua from "../../utils/lingua";
|
2021-04-28 01:34:29 +00:00
|
|
|
export = class E926 extends Command {
|
2021-04-23 01:54:26 +00:00
|
|
|
constructor() {
|
|
|
|
super({
|
2021-04-28 01:34:29 +00:00
|
|
|
name: "e926",
|
2021-04-23 01:54:26 +00:00
|
|
|
description: "Get an Image from E621",
|
2021-04-28 01:34:29 +00:00
|
|
|
aliases: ['e9', 'enine'],
|
2021-04-23 01:54:26 +00:00
|
|
|
cooldown: 1,
|
2021-04-28 01:34:29 +00:00
|
|
|
|
2021-04-23 01:54:26 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
async command(ctx: Context) {
|
2021-05-07 23:57:48 +00:00
|
|
|
let embed = new MessageEmbed().setColor(ctx.config.variables.color).setFooter(`${ctx.config.variables.name}`, ctx.config.variables.avatar)
|
2021-04-23 01:54:26 +00:00
|
|
|
// @ts-ignore
|
|
|
|
if (ctx.args.length < 1) return ctx.channel.send(embed.setTitle(lingua[ctx.settings.locale].NOT_ENOUGH_TAGS).setDescription(lingua[ctx.settings.locale].NOT_ENOUGH_TAGS_DES))
|
2021-04-28 01:34:29 +00:00
|
|
|
let request = await yiff.e926(ctx.args.join(" "))
|
2021-04-23 01:54:26 +00:00
|
|
|
if (ctx.settings.embeds) {
|
2021-04-28 01:34:29 +00:00
|
|
|
embed.setAuthor('e926.net', 'https://thaldrin.media/e621.png', `https://e926.net/post/${request[0].id}`)
|
2021-04-23 01:54:26 +00:00
|
|
|
.setImage(request[0].file.url)
|
2021-04-28 01:34:29 +00:00
|
|
|
.setDescription(`[Link](https://e926.net/post/${request[0].id})`)
|
2021-04-23 01:54:26 +00:00
|
|
|
ctx.channel.send(embed)
|
|
|
|
} else {
|
2021-04-28 01:34:29 +00:00
|
|
|
ctx.channel.send(`<https://e926.net/post/${request[0].id}>\n\n${request[0].file.url}`)
|
2021-04-23 01:54:26 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|