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

discord-canvas-easy

v3.2.1

Published

Simple canvas with discord-canvas-easy

Downloads

85

Readme

discord-canvas-easy

From simple image with configurable canvas

More canvas coming soon

Simple canvas with discord-canvas-easy

npm

NPM

V3.2.1

Example of code

const Canvas = require("discord-canvas-easy");
const Discord = require("discord.js");
const intents = new Discord.IntentsBitField(3276799);
const bot = new Discord.Client({intents});

bot.on("ready", () => {
    console.log("I'm login !")
});

bot.on("messageCreate", async message => {

    if(message.content === "!rank") {

        const Rank = await new Canvas.Card()
        .setGuild(message.guild)
        .setUser(message.author)
        .setBackground("https://lh3.googleusercontent.com/proxy/RlfqL01K_816kNExzofpQ_D206IJmGAYR9e6Nll6AaLgBsReYelwxt--_z1q91ejmeIjHBkB-AYb-1O-qwnoswX1pKGH61jETg_OWSELWK5HSmfScVK56fkT2QoJGsCOfTNWHskc")
        .setRank(2) //optional
        .setLevel(5) //optional
        .setXpNeed(6000) //optional
        .setXp(2457) //optional
        .setColorFont("#000000") //optional
        .setColorProgressBar("#ff4837") //optional
        .toCard()

        message.reply({files: [new Discord.AttachmentBuilder(Rank.toBuffer(), "rank.png")]})
    }

    if(message.content === "!leaderboard") {

        const Leaderboard = await new Canvas.Leaderboard()
        .setBot(bot)
        .setGuild(message.guild)
        .setBackground("https://images.unsplash.com/photo-1555949963-ff9fe0c870eb?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=720&ixid=MnwxfDB8MXxyYW5kb218MHx8Y29kZXx8fHx8fDE2MzAxNzA4NzM&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=1280")
        .addUser(message.author, 8 /*the level*/, 4589 /*the xp*/, 9000 /*the xp need*/)
        .setColorFont("#ffffff") //optional
        .toLeaderboard()

        message.reply({files: [new Discord.AttachmentBuilder(Leaderboard.toBuffer(), "leaderboard.png")]})
    }
});

bot.on("guildMemberAdd", async member => {

    const Welcome = await new Canvas.Home()
    .setGuild(member.guild)
    .setBackground("https://lh3.googleusercontent.com/proxy/RlfqL01K_816kNExzofpQ_D206IJmGAYR9e6Nll6AaLgBsReYelwxt--_z1q91ejmeIjHBkB-AYb-1O-qwnoswX1pKGH61jETg_OWSELWK5HSmfScVK56fkT2QoJGsCOfTNWHskc")
    .setUser(member.user)
    .setText("Welcome {user.username} on the server !") /*optionnal*/ /*you can put {user.username} {user.tag} {server.name} {server.memberCount} for the datas*/
    .setColorFont("#ffffff") //optional
    .toHome()

    await bot.channels.cache.get("CHANNEL_ID").send({files: [new Discord.AttachmentBuilder(Welcome.toBuffer(), "welcome.png")]})
})

bot.on("guildMemberRemove", async member => {

    const Goodbye = await new Canvas.Home()
    .setGuild(member.guild)
    .setBackground("https://lh3.googleusercontent.com/proxy/RlfqL01K_816kNExzofpQ_D206IJmGAYR9e6Nll6AaLgBsReYelwxt--_z1q91ejmeIjHBkB-AYb-1O-qwnoswX1pKGH61jETg_OWSELWK5HSmfScVK56fkT2QoJGsCOfTNWHskc")
    .setUser(member.user)
    .setText("See you soon {user.username} !") /*optionnal*/ /*you can put {user.username} {user.tag} {server.name} {server.memberCount} for the datas*/
    .setColorFont("#ffffff") //optional
    .toHome()

    await bot.channels.cache.get("CHANNEL_ID").send({files: [new Discord.AttachmentBuilder(Goodbye.toBuffer(), "goodbye.png")]})
})

bot.login("YOUR_TOKEN");

img img img