npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

welcome-v2

v0.0.1

Published

welcome-v2 is a powerful canvas project with high-quality design.

Downloads

43

Readme

welcome-v2

welcome-v2 is a Node.js module for creating customized welcome images for Discord servers. It allows you to generate beautiful welcome images with user avatars, usernames, and a custom message.

Installation

You can install welcome-v2 via npm:

npm install welcome-v2

Usage

Here's an example of how to use welcome-v2 in your Discord bot:

const { Client, GatewayIntentBits } = require('discord.js');
const { Welcome } = require('welcome-v2'); 

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMembers,
  ],
});

// Remove "//" if you need multiple backgrounds 
// const backgroundImages = [
//    'your png background link here',
//    'your png background link here',
//    'your png background link here',
//    'your png background link here',
//  ];
// let currentBackgroundIndex = 0; 

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}`);
});

client.on('guildMemberAdd', async (member) => {
  const channelId = '1157243263728762900'; // Replace with the desired channel ID
  const channel = await client.channels.fetch(channelId); // Fetch the channel by ID
  if (channel) {
   
    const welcomeCard = new Welcome()
      .setName(member.user.username) // To change the color of the text, use this .setName(member.user.username , '#FFFFFF')  You can replace with your own hex code 
      .setAvatar(member.user.displayAvatarURL({ format: 'png' }))
      .setTitle('Welcome') // To change the color of the text, use this .setTitle('Welcome`, '#FFFFFF') You can replace with your own hex code 
      .setMessage(`You are our ${member.guild.memberCount} Member`)  // To change the color of the text, use this .setMessage(`You are our ${member.guild.memberCount} Member`, '#FFFFFF') You can replace with your own hex code 
   // Remove "//" if you have added background 
   //   .setBackground(backgroundImages[currentBackgroundIndex]); 
    
    const welcomeImageBuffer = await welcomeCard.build();

    
    channel.send({ files: [welcomeImageBuffer] });

// Remove "//" if you have multiple backgrounds and want a different background every time 
//    currentBackgroundIndex = (currentBackgroundIndex + 1) % backgroundImages.length;
  }
});

client.login("Bot_Token_Here")

API

new Welcome(options)

  • options (Object) - An object with the following optional properties:
    • username (String) - The username to display on the welcome card.
    • avatar (String) - The URL of the user's avatar.
    • title (String) - The title text on the welcome card.
    • message (String) - The message to display on the welcome card.
    • background (String) - The background to display on the welcome card.
    • usernameColor (String) - (Optional) The color for the username text (default is #FFD700).
    • titleColor (String) - (Optional) The color for the title text (default is #00BFFF).
    • messageColor (String) - (Optional) The color for the message text (default is #FFFFFF).

setName(name, usernameColor)

  • Set the username for the welcome card. Optionally, you can specify the color for the username text.

setAvatar(image)

  • Set the avatar image for the welcome card.

setTitle(title, titleColor)

  • Set the title text for the welcome card. Optionally, you can specify the color for the title text.

setMessage(message, messageColor)

  • Set the message to display on the welcome card. Optionally, you can specify the color for the message text.

setBackground(background)

  • Set the background to display on the welcome card.

Preview

preview

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This module is based on napi-rs/canvas for canvas rendering.

Contact

If you have any questions or suggestions, feel free to contact us.