Hug someone with a Gif!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios')
const { data } = await axios("https://neko-love.xyz/api/v1/hug").catch(err => {})
let messagePrompts = [
`${data.url}`,
`https://cdn.weeb.sh/images/rJv2H5adf.gif`
];
//You can add ur Gif list after line 8 and you can remove line 9 if you want. if you want to use another API do changes in data.url as per API output//
if (
context.params.event.content.split(' ')[0].toLowerCase() ===
`${process.env.PREFIX}hug`
) {
const author = context.params.event.mentions.length
? context.params.event.mentions[0]
: context.params.event.author;
let messageChoice = Math.floor(Math.random() * messagePrompts.length);
let message = messagePrompts[messageChoice];
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: context.params.event.channel_id,
content:
author.id === context.params.event.author.id
? `<@${author.id}> hugged themselves~`
: `<@${context.params.event.author.id}> hugged <@${author.id}>`,
embed: {
image: {url: data.url},
color: 0x00b3ff,
},
});
}