mirror of
https://github.com/thaldrin/thaldrin.git
synced 2024-08-14 23:57:21 +00:00
various changes / added e621 command
This commit is contained in:
parent
15f97d3158
commit
c8bec12a3c
3 changed files with 42 additions and 5 deletions
|
@ -52,11 +52,11 @@ export default class Thaldrin extends Client {
|
||||||
const file = require(path.join(__dirname, '../../modules', module, command));
|
const file = require(path.join(__dirname, '../../modules', module, command));
|
||||||
const Command = new file();
|
const Command = new file();
|
||||||
Command.module = module
|
Command.module = module
|
||||||
Logger.info({
|
// Logger.info({
|
||||||
type: "command:loaded",
|
// type: "command:loaded",
|
||||||
command: Command.name,
|
// command: Command.name,
|
||||||
message: `${Command.name} was loaded`
|
// message: `${Command.name} was loaded`
|
||||||
})
|
// })
|
||||||
this.commands.set(Command.name, Command);
|
this.commands.set(Command.name, Command);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
32
src/modules/images/e621.ts
Normal file
32
src/modules/images/e621.ts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import yiff from "../../utils/yiff"
|
||||||
|
import Command from "../../handler/structures/Command"
|
||||||
|
import { Context } from "../../utils/types";
|
||||||
|
import { MessageEmbed } from "discord.js"
|
||||||
|
import embed from "../../utils/embed";
|
||||||
|
import lingua from "../../utils/lingua";
|
||||||
|
export = class E621 extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "e621",
|
||||||
|
description: "Get an Image from E621",
|
||||||
|
aliases: ['e6', 'esix'],
|
||||||
|
cooldown: 1,
|
||||||
|
nsfw: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async command(ctx: Context) {
|
||||||
|
// @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))
|
||||||
|
let request = await yiff.e621(ctx.args.join(" "))
|
||||||
|
if (ctx.settings.embeds) {
|
||||||
|
embed.setAuthor('e621.net', 'https://thaldrin.media/e621.png', `https://e621.net/post/${request[0].id}`)
|
||||||
|
.setImage(request[0].file.url)
|
||||||
|
.setDescription(`[Link](https://e621.net/post/${request[0].id})`)
|
||||||
|
ctx.channel.send(embed)
|
||||||
|
} else {
|
||||||
|
ctx.channel.send(`<https://e621.net/post/${request[0].id}>\n\n${request[0].file.url}`)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
src/utils/embed.ts
Normal file
5
src/utils/embed.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { MessageEmbed } from "discord.js";
|
||||||
|
import config from '../../config'
|
||||||
|
export default new MessageEmbed()
|
||||||
|
.setColor(config.variables.color)
|
||||||
|
.setFooter(`${config.variables.name}`, config.variables.avatar)
|
Loading…
Reference in a new issue