Type (prefix) @mention example: a.pat @suzuki ( You can change it's prefix by changing what is on messge.create.prefix)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
let me = await lib.discord.users['@0.2.0'].me.list();
let user = await lib.discord.users['@0.2.0'].retrieve({
user_id: context.params.event.author.id,
});
const author = context.params.event.mentions.length
? context.params.event.mentions[0]
: context.params.event.author;
const image = await axios('https://api.waifu.pics/sfw/pat').then((res) =>
res.data ? res.data.url : null
);
if (!image)
return lib.discord.channels['@0.2.0'].messages.create({
content: `Error. Something went 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: {
description: ``,
image: {url: image},
color: parseInt(process.env.EMBEDCOLOR),
author: {
name: `${user.username} pat ${author.username}`,
icon_url: user.avatar_url,
},
},
});