3.2.1 • Published 1 year ago

discord-canvas-easy v3.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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

3.2.1

1 year ago

3.2.0

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

2.6.1

2 years ago

2.6.0

2 years ago

2.6.3

2 years ago

2.6.2

2 years ago

2.7.4

2 years ago

2.5.6

2 years ago

2.7.3

2 years ago

2.5.5

2 years ago

2.7.6

2 years ago

2.5.8

2 years ago

2.7.5

2 years ago

2.5.7

2 years ago

3.0.0

2 years ago

2.7.8

2 years ago

2.7.7

2 years ago

2.5.9

2 years ago

2.5.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.7.0

2 years ago

2.5.2

2 years ago

2.3.4

2 years ago

2.5.1

2 years ago

2.3.3

2 years ago

2.7.2

2 years ago

2.5.4

2 years ago

2.7.1

2 years ago

2.5.3

2 years ago

2.3.5

2 years ago

2.6.5

2 years ago

2.6.4

2 years ago

2.6.7

2 years ago

2.6.6

2 years ago

2.6.9

2 years ago

2.6.8

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.1

2 years ago

2.2.5

2 years ago

1.8.0

3 years ago

1.7.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.5.5

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.6.0

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.3.6

3 years ago

1.4.0

3 years ago

1.3.5

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.5

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago