When someone types !wasted, an image of your avatar with the word “wasted” will appear.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.content.startsWith('!wasted')) {
const avatar = context.params.event.mentions.length
? context.params.event.mentions[0].avatar
: context.params.event.author.avatar;
const ID = context.params.event.mentions.length
? context.params.event.mentions[0].id
: context.params.event.author.id;
let avatarLink = `https://cdn.discordapp.com/avatars/${ID}/${avatar}`;
let tiggeredImg = await lib.http.request['@1.1.5']({
method: 'GET',
url: `https://some-random-api.ml/canvas/wasted/?avatar=${avatarLink}`,
}).then((result) => {
return result.body;
});
return lib.discord.channels['@0.1.0'].messages.create({
channel_id: context.params.event.channel_id,
content: '',
file: tiggeredImg,
filename: 'test.gif',
});
}