mirror of https://github.com/thaldrin/thaldrin.git
create animal commands and use imageproxy
This commit is contained in:
parent
e134e65045
commit
4a48b3f2b0
|
@ -0,0 +1,30 @@
|
||||||
|
import { Context } from "@utils/types"
|
||||||
|
import { Command } from "@modules/eu/src/index"
|
||||||
|
import request from "@utils/animals"
|
||||||
|
import { MessageEmbed } from "discord.js"
|
||||||
|
|
||||||
|
export = class Cat extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "cat",
|
||||||
|
description: "Sends a random cat image",
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(context: Context): Promise<any> {
|
||||||
|
let { image, provider } = await request("cat")
|
||||||
|
// console.log({ image, provider })
|
||||||
|
if (context.settings.embeds) {
|
||||||
|
let Embed = new MessageEmbed()
|
||||||
|
.setImage(image[0])
|
||||||
|
.setFooter(`Thaldrin - Image provided by ${provider}`, "https://thaldrin.media/avatar.png")
|
||||||
|
.setColor("ORANGE")
|
||||||
|
|
||||||
|
context.channel.send({ embeds: [Embed] })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.channel.send(image[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { Context } from "@utils/types"
|
||||||
|
import { Command } from "@modules/eu/src/index"
|
||||||
|
import request from "@utils/animals"
|
||||||
|
import { MessageEmbed } from "discord.js"
|
||||||
|
|
||||||
|
export = class Fox extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "fox",
|
||||||
|
description: "Sends a random fox image",
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(context: Context): Promise<any> {
|
||||||
|
let data = await request("fox")
|
||||||
|
if (context.settings.embeds) {
|
||||||
|
let Embed = new MessageEmbed()
|
||||||
|
.setImage(data.image.url)
|
||||||
|
.setFooter(`Thaldrin - Image provided by ${data.provider}`, "https://thaldrin.media/avatar.png")
|
||||||
|
.setColor("ORANGE")
|
||||||
|
|
||||||
|
context.channel.send({ embeds: [Embed] })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.channel.send(data.image.url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { Context } from "@utils/types"
|
||||||
|
import { Command } from "@modules/eu/src/index"
|
||||||
|
import request from "@utils/animals"
|
||||||
|
import { MessageEmbed } from "discord.js"
|
||||||
|
|
||||||
|
export = class Hyena extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "hyena",
|
||||||
|
aliases: ["yeen"],
|
||||||
|
description: "Sends a random yeen",
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(context: Context): Promise<any> {
|
||||||
|
let data = await request("hyena")
|
||||||
|
|
||||||
|
if (context.settings.embeds) {
|
||||||
|
let Embed = new MessageEmbed()
|
||||||
|
.setImage(data.image.url)
|
||||||
|
.setFooter(`Thaldrin - Image provided by ${data.provider}`, "https://thaldrin.media/avatar.png")
|
||||||
|
.setColor("ORANGE")
|
||||||
|
|
||||||
|
context.channel.send({ embeds: [Embed] })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.channel.send(data.image.url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { Context } from "@utils/types"
|
||||||
|
import { Command } from "@modules/eu/src/index"
|
||||||
|
import request from "@utils/animals"
|
||||||
|
import { MessageEmbed } from "discord.js"
|
||||||
|
|
||||||
|
export = class Shibe extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "shibe",
|
||||||
|
description: "Sends a random shibe",
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(context: Context): Promise<any> {
|
||||||
|
let { image, provider } = await request("shibe")
|
||||||
|
// console.log({ image, provider })
|
||||||
|
if (context.settings.embeds) {
|
||||||
|
let Embed = new MessageEmbed()
|
||||||
|
.setImage(image[0])
|
||||||
|
.setFooter(`Thaldrin - Image provided by ${provider}`, "https://thaldrin.media/avatar.png")
|
||||||
|
.setColor("ORANGE")
|
||||||
|
|
||||||
|
context.channel.send({ embeds: [Embed] })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.channel.send(image[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { Context } from "@utils/types"
|
||||||
|
import { Command } from "@modules/eu/src/index"
|
||||||
|
import request from "@utils/animals"
|
||||||
|
import { MessageEmbed } from "discord.js"
|
||||||
|
|
||||||
|
export = class Wolf extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "wolf",
|
||||||
|
description: "Sends a random Wolf image",
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(context: Context): Promise<any> {
|
||||||
|
let data = await request("wolf")
|
||||||
|
|
||||||
|
if (context.settings.embeds) {
|
||||||
|
let Embed = new MessageEmbed()
|
||||||
|
.setImage(data.image.url)
|
||||||
|
.setFooter(`Thaldrin - Image provided by ${data.provider}`, "https://thaldrin.media/avatar.png")
|
||||||
|
.setColor("ORANGE")
|
||||||
|
|
||||||
|
context.channel.send({ embeds: [Embed] })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.channel.send(data.image.url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +1,40 @@
|
||||||
|
import { ApplicationCommandPermissionTypes } from "discord.js/typings/enums";
|
||||||
import yiff from "./yiff";
|
import yiff from "./yiff";
|
||||||
|
|
||||||
type animal = "bird" | "cat" | "fox" | "hyena" | "shibe" | "wolf";
|
type animal = "bird" | "cat" | "fox" | "hyena" | "shibe" | "wolf";
|
||||||
|
|
||||||
export default async function request(animal: animal) {
|
export default async function request(animal: animal) {
|
||||||
switch (animal) {
|
switch (animal) {
|
||||||
case "shibe":
|
case "shibe": {
|
||||||
return { image: await yiff.shibe("shibes", 1), provider: "shibe.online" };
|
let request = await yiff.shibe("shibes", 1)
|
||||||
case "bird":
|
|
||||||
return { image: await yiff.shibe("birds", 1), provider: "shibe.online" };
|
let proxied = request.map(x => ("https://proxy.thaldrin.media/" + x))
|
||||||
case "cat":
|
return { image: proxied, provider: "shibe.online" };
|
||||||
return { image: await yiff.shibe("cats", 1), provider: "shibe.online" };
|
}
|
||||||
case "fox":
|
case "bird": {
|
||||||
return { image: await yiff.thaldrin("foxes"), provider: "thaldr.in" };
|
let request = await yiff.shibe("birds", 1)
|
||||||
case "hyena":
|
let proxied = request.map(x => ("https://proxy.thaldrin.media/" + x))
|
||||||
return { image: await yiff.thaldrin("yeens"), provider: "thaldr.in" };
|
return { image: proxied, provider: "shibe.online" };
|
||||||
case "wolf":
|
}
|
||||||
return { image: await yiff.thaldrin("wolves"), provider: "thaldr.in" };
|
case "cat": {
|
||||||
|
let request = await yiff.shibe("cats", 1)
|
||||||
|
let proxied = request.map(x => ("https://proxy.thaldrin.media/" + x))
|
||||||
|
return { image: proxied, provider: "shibe.online" };
|
||||||
|
}
|
||||||
|
case "fox": {
|
||||||
|
let image = await yiff.thaldrin("foxes")
|
||||||
|
image.url = "https://proxy.thaldrin.media/" + image.url
|
||||||
|
return { image, provider: "thaldr.in" };
|
||||||
|
}
|
||||||
|
case "hyena": {
|
||||||
|
let image = await yiff.thaldrin("yeens")
|
||||||
|
image.url = "https://proxy.thaldrin.media/" + image.url
|
||||||
|
return { image, provider: "thaldr.in" };
|
||||||
|
}
|
||||||
|
case "wolf": {
|
||||||
|
let image = await yiff.thaldrin("wolves")
|
||||||
|
image.url = "https://proxy.thaldrin.media/" + image.url
|
||||||
|
return { image, provider: "thaldr.in" };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue