npm.io
1.0.6 • Published 1 year ago

discord-welcome-image

Licence
ISC
Version
1.0.6
Deps
2
Size
14 kB
Vulns
0
Weekly
0

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.



Discord



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}>!` });
  }
});



Not BackgroundURL

Example

BackgroundURL & GradientColor

Example