2020-12-15 01:44:28 +00:00
|
|
|
import {URL} from "url";
|
2021-04-05 04:35:12 +00:00
|
|
|
import {Command, NamedCommand} from "../../core";
|
|
|
|
import {getContent} from "../../lib";
|
2020-12-15 01:44:28 +00:00
|
|
|
|
2021-03-30 23:14:15 +00:00
|
|
|
const endpoints: {sfw: {[key: string]: string}} = {
|
|
|
|
sfw: {
|
|
|
|
tickle: "/img/tickle",
|
|
|
|
slap: "/img/slap",
|
|
|
|
poke: "/img/poke",
|
|
|
|
pat: "/img/pat",
|
|
|
|
neko: "/img/neko",
|
|
|
|
meow: "/img/meow",
|
|
|
|
lizard: "/img/lizard",
|
|
|
|
kiss: "/img/kiss",
|
|
|
|
hug: "/img/hug",
|
|
|
|
foxGirl: "/img/fox_girl",
|
|
|
|
feed: "/img/feed",
|
|
|
|
cuddle: "/img/cuddle",
|
|
|
|
why: "/why",
|
|
|
|
catText: "/cat",
|
|
|
|
fact: "/fact",
|
|
|
|
nekoGif: "/img/ngif",
|
|
|
|
kemonomimi: "/img/kemonomimi",
|
|
|
|
holo: "/img/holo",
|
|
|
|
smug: "/img/smug",
|
|
|
|
baka: "/img/baka",
|
|
|
|
woof: "/img/woof",
|
|
|
|
spoiler: "/spoiler",
|
|
|
|
wallpaper: "/img/wallpaper",
|
|
|
|
goose: "/img/goose",
|
|
|
|
gecg: "/img/gecg",
|
|
|
|
avatar: "/img/avatar",
|
|
|
|
waifu: "/img/waifu"
|
|
|
|
}
|
|
|
|
};
|
2020-12-15 01:44:28 +00:00
|
|
|
|
2021-04-05 04:35:12 +00:00
|
|
|
export default new NamedCommand({
|
2020-12-15 01:44:28 +00:00
|
|
|
description: "Provides you with a random image with the selected argument.",
|
2021-04-10 13:34:55 +00:00
|
|
|
async run({send, message, channel, guild, author, member, client, args}) {
|
|
|
|
send(`Please provide an image type. Available arguments:\n\`[${Object.keys(endpoints.sfw).join(", ")}]\`.`);
|
2020-12-15 01:44:28 +00:00
|
|
|
},
|
|
|
|
any: new Command({
|
|
|
|
description: "Image type to send.",
|
2021-04-10 13:34:55 +00:00
|
|
|
async run({send, message, channel, guild, author, member, client, args}) {
|
2021-04-05 04:35:12 +00:00
|
|
|
const arg = args[0];
|
2021-04-10 13:34:55 +00:00
|
|
|
if (!(arg in endpoints.sfw)) return send("Couldn't find that endpoint!");
|
2021-03-30 23:14:15 +00:00
|
|
|
let url = new URL(`https://nekos.life/api/v2${endpoints.sfw[arg]}`);
|
2020-12-15 01:44:28 +00:00
|
|
|
const content = await getContent(url.toString());
|
2021-04-10 13:34:55 +00:00
|
|
|
return send(content.url);
|
2020-12-15 01:44:28 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|