Package Exports
- discord-welcome-image
- discord-welcome-image/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (discord-welcome-image) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
๐ Discord-welcome-image
Generate custom welcome images for bots, servers or communities. This module allows you to create images with avatars, custom texts, borders and visual effects such as blur and gradients.๐ฆ Installation
npm i discord-welcome-image
๐ Options
Option | Type | Description |
---|---|---|
member |
object |
The username to display, banner and avatar (OBLIGAORY). |
backgroundURL |
string |
The URL of the background image. |
circularAvatar |
boolean |
Whether the avatar should be displayed as a circle. |
showDate |
boolean |
Whether to show the current date. |
border |
boolean |
Whether to show a border around the image. |
borderColor |
string or object |
The color of the border; can be a string or an array for gradient effects. |
gradientDirection |
string |
The direction of the gradient (e.g., horizontal , vertical ,diagonal ). |
maxNameLength |
number |
Maximum length for the username. |
welcomeText |
string |
Text to display as a welcome message. |
blurBackground |
boolean |
Whether to apply a blur effect to the background. |
๐ Example
const generateWelcomeImage = require('discord-welcome-image')
const WELCOME_CHANNEL_ID = 'CHANNEL ID';
client.on('guildMemberAdd', async member => {
const user = await member.user.fetch();
const welcomeBuffer = await generateWelcomeImage({
member, //Banner & Avatar & Name this is 100% OBLIGATORY
circularAvatar: true, //Circular or square avatar display
showDate: true, //Show date true or false
border: true, //Border true or false
borderColor: ['#00ff00', '#ff00ff'], //Array or String
gradientDirection: 'horizontal', //horizontal, vertical, diagonal
maxNameLength: 11, //Max lenght of username
welcomeText: 'Welcome', //Custom message
blurBackground: true, //Backgroun blur
});
const attachment = new AttachmentBuilder(welcomeBuffer, { name: 'welcome.png' });
const channel = member.guild.channels.cache.get(WELCOME_CHANNEL_ID);
if (channel) {
channel.send({ files: [attachment], content: `๐ ยกBienvenido/a <@${member.id}>!` });
}
});