This prefix command '!waifu' returns random waifu images
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
if (context.params.event.content.startsWith('!waifu')) {
const image = await axios('https://api.waifu.pics/sfw/waifu').then((res) =>
res.data ? res.data.url : null
);
if (!image)
return lib.discord.channels['@0.2.0'].messages.create({
content: `Something went wrong, unable to get the image.`,
channel_id: context.params.event.channel_id,
});
await lib.discord.channels['@0.2.0'].messages.create({
content: ``,
channel_id: context.params.event.channel_id,
embed: {
image: {url: image},
color: 0xffc0cb,
},
});
}