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

welcomecards

v1.0.2

Published

Discord.js v12 Welcome Cards

Downloads

5

Readme

WelcomeCard Class

Overview

The WelcomeCard class is a utility for creating and sending welcome cards with custom background images and user information in Discord servers.

Installation

To use the WelcomeCard class, ensure you have Node.js installed on your system. Then, follow these steps:

  1. Install the required dependencies by running:

    npm install canvas discord.js
  2. Include the WelcomeCard class in your project.

Usage

  1. Import the WelcomeCard class into your script:

    const WelcomeCard = require('./WelcomeCard');
  2. Create an instance of the WelcomeCard class, passing an object with configuration options:

    const welcomeCard = new WelcomeCard({
      discordClient: yourDiscordClient,
      backgroundImage: 'path/to/background/image.jpg',
      cardDescription: 'Your welcome message here.',
      cardTitle: 'Welcome to the server, [username]!',
      canvasWidth: 600,
      canvasHeight: 300,
      avatarBorderSide: 4,
      offset: 18,
    });

    Replace yourDiscordClient with your Discord.js client instance and provide the path to your background image, welcome message, and card title. You can also customize canvas dimensions, avatar border size, and offset as needed.

  3. Call the send method of the WelcomeCard instance to send the welcome card to a Discord channel:

    const channelId = 'yourChannelId';
    const member = await yourDiscordClient.users.fetch('memberId');
    welcomeCard.send(channelId, member);

    Replace yourChannelId with the ID of the Discord channel where you want to send the welcome card, and memberId with the ID of the member you want to welcome.

Example

const { Client } = require('discord.js');
const WelcomeCard = require('./WelcomeCard');

const client = new Client();

client.once('ready', () => {
  console.log('Bot is ready');
});

client.on('guildMemberAdd', async (member) => {
  const welcomeCard = new WelcomeCard({
    discordClient: client,
    backgroundImage: 'path/to/background/image.jpg',
    cardDescription: 'Welcome to our server! Enjoy your stay.',
    cardTitle: 'Welcome to the server, [username]!',
    canvasWidth: 600,
    canvasHeight: 300,
    avatarBorderSide: 4,
    offset: 18,
  });

  const channelId = 'yourChannelId';
  welcomeCard.send(channelId, member);
});


client.login('yourBotToken');

Replace 'yourBotToken' with your Discord bot token, and 'yourChannelId' with the ID of the Discord channel where you want to send the welcome card.

While utilizing this package, should you encounter any challenges or require assistance, please do not hesitate to reach out to snoofz on Discord for prompt and professional support.