Messages users who join your server with a friendly welcome embed message in the channel of your choice. You must have privileged intents enabled for your Discord bot settings for this snippet to work.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// *** Set the channel ID to post in ***
const channel_id = process.env.WELCOME_CHANNEL_ID
await lib.discord.channels['@0.1.1'].messages.create({
channel_id,
content: `Welcome to this server <@${context.params.event.user.id}>!`,
embed: {
title: 'Guild Rules',
type: 'rich',
color: 0x0000AA,
description: 'Here are some things to know about this guild:',
fields: [{
name: 'Rule #1',
value: `Introduce yourself!`
}, {
name: 'Rule #2',
value: 'Be yourself!'
}, {
name: 'Rule #3',
value: `Don't be evil.`
}, {
name: 'More Important Information',
value: [
'You could put a link with more important information about this guild here:',
`https://autocode.com/`
].join('\n')
}]
}
});