TravBot-v3/src/commands/fun/neko.ts

55 lines
1.7 KiB
TypeScript
Raw Normal View History

2020-12-15 01:44:28 +00:00
import {URL} from "url";
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
export default new NamedCommand({
2020-12-15 01:44:28 +00:00
description: "Provides you with a random image with the selected argument.",
async run({message, channel, guild, author, member, client, args}) {
channel.send(
2020-12-15 07:56:09 +00:00
`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.",
async run({message, channel, guild, author, member, client, args}) {
const arg = args[0];
if (!(arg in endpoints.sfw)) return channel.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());
return channel.send(content.url);
2020-12-15 01:44:28 +00:00
}
})
});