Discord welcome system w/ logs. Make sure to fill out the environment variables required for this to work correctly. Feel free to change the content of the welcome message on line 17.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let username = context.params.event.user.username;
let discriminator = context.params.event.user.discriminator;
let user = context.params.event.user.id;
let logchannel = process.env.logchannel;
let welcomechannel = process.env.welcomechannel;
let servername = process.env.servername;
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${welcomechannel}`,
content: `<@${context.params.event.user.id}>`,
tts: false,
embeds: [
{
type: 'rich',
title: `Welcome`,
description: `Welcome to ${servername}! Feel free to have a look around`,
color: 0x01f2ff,
timestamp: `${context.params.event.joined_at}`,
author: {
name: `${servername} Welcome System`,
},
footer: {
text: `${username} #${discriminator}`,
},
},
],
});
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${logchannel}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `User Joined`,
description: `${username} #${discriminator} Just Joined the server`,
color: 0x1855ed,
timestamp: `${context.params.event.joined_at}`,
author: {
name: `Welcome System | Created By James K.#4030`,
},
footer: {
text: `${username} #${discriminator}`,
},
},
],
});