Says hello to a user when they mention the bot. It includes a simple embed message with the user's avatar.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const author = context.params.event.author;
let avatarLink = `https://cdn.discordapp.com/avatars/${author.id}/${author.avatar}`;
let surveyURL = await lib.http.request['@1.1.5']({
method: 'GET',
url: avatarLink + '.gif',
});
if (surveyURL.statusCode === 200) avatarLink += '.gif';
await lib.discord.channels['@0.1.0'].messages.create({
channel_id: context.params.event.channel_id,
content: ``,
embed: {
title: `Hello!`,
description: `<@${author.id}>`,
thumbnail: {url: avatarLink + '?size=1024'},
color: 0xff1493,
},
});