Get a random waifu picture with a random embed color. Makes it more cute than the normal one with only one color.
//Created by ThePhenix16 all rights reserved. Have fun with it!!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
const colors = [
//Put your own colors here, you can add more.
0xffc0cb,
0x1777df,
0xcf1940,
0x2f8f52,
0xaec72e,
0xbb650f,
];
const randomColor = colors[Math.floor(Math.random() * colors.length)];
if (context.params.event.content.startsWith(`${process.env.PREFIX}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: `Oops sorry , something is wrong`,
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: randomColor
},
});
}