There isn't much to talk about the command, just do -respect and you will see how it works.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.content.startsWith('-respect')) {
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;
const author = context.params.event.mentions.length
? context.params.event.mentions[0]
: context.params.event.author;
let avatarLink = `https://cdn.discordapp.com/avatars/${ID}/${avatar}`;
let respectIMg = await lib.http.request['@1.1.5']({
method: 'GET',
url: `https://some-random-api.ml/canvas/passed/?avatar=${avatarLink}`,
}).then((result) => {
return result.body;
});
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: context.params.event.channel_id,
content:
author.id === context.params.prefix
? `<@${author.id}> RESPECT HIMSLEF`
: `<@${context.params.event.author.id}> RESPECT <@${author.id}>`,
file: respectIMg,
filename: 'Mission passed.png',
});
}