If someone types "(prefix)invite" in your bot's dm then they will get the invite link to your bot.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.content.startsWith(`${process.env.PREFIX}invite`)) {
let info = await lib.discord.users['@0.1.5'].me.list();
let id = info.id;
let Avatar = info.avatar_url;
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embed: {
type: 'rich',
title: `Invite link`,
description: `Click the button to invite me to your server!`,
color: 0x0093ff,
thumbnail: {
url: Avatar,
},
},
components: [
{
type: 1,
components: [
{
style: 5,
label: `Invite Link`,
url: `https://discord.com/oauth2/authorize?client_id=${id}&scope=identify%20bot%20applications.commands&permissions=2146958591`,
disabled: false,
type: 2,
},
],
},
],
});
}