2.0.3 • Published 3 years ago

discanvas v2.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

discanvas

From simple image with configurable canvas

More canvas coming soon

Simple canvas with discanvas

npm

NPM

V2.0.3

Example of code

const discanvas = require('discanvas');
const { Client, Intents } = require('discord.js');
const client = new Client({
    intents: [
        Intents.FLAGS.GUILDS,
        Intents.FLAGS.GUILD_MEMBERS,
        Intents.FLAGS.GUILD_PRESENCES,
        Intents.FLAGS.GUILD_MESSAGES,
    ]
});

client.on('ready', () => {
    console.log('I connect to ' + client.user.tag)
});

client.on('messageCreate', async message => {
    if (message.content === '!rankcard') {
        const rankcard = await new discanvas.RankCard()
        .setAvatar('https://cdn.discordapp.com/avatars/' + message.member.id + '/' + message.author.avatar + '.png')
        .setLevel(1)
        .setCurrentXP(200)
        .setRequiredXP(400)
        .setProgressBar('#ff5555')
        .setStatus(message.member.presence?.status)
        .setUsername(message.author.username)
        .setDiscriminator(message.author.discriminator)
        .setTop(1)
        .setBackground('BACKGROUND', 'https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg')
        //or : .setBackground('COLOR', '#ff5555')
        .setSquareOpacity(0.5)
        .setBorderColor('#00ff55')
        .toCard()

        message.reply({ files: [{ attachment: rankcard.toBuffer(), name: 'rankcard-' + message.member.id + '.png' }] });
    }
});

img

client.on('guildMemberAdd', async member => {
    const welcome = await new discanvas.Welcome()
    .setAvatar('https://cdn.discordapp.com/avatars/' + member.id + '/' + member.user.avatar + '.png')
    .setUsername(message.author.username)
    .setDiscriminator(message.author.discriminator)
    .setBackground('BACKGROUND', 'https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg')
    //or : .setBackground('COLOR', '#ff5555')
    .setMainText('Welcome')
    .setSecondText('We are now ' + member.guild.memberCount + ' in the guild !')
    /*
    .setCircleColor('#ff5555')
    .setMainTextColor('#ff5555')
    .setSecondTextColor('#ff5555')
    .setPseudoColor('#ff5555')
    */
    .toWelcome()

    member.guild.channels.cache.get('channelId').send({ content: 'Welcome ' + member.toString(), files: [{ attachment: welcome.toBuffer(), name: 'welcome-' + member.id + '.png' }] });
});

img

client.on('guildMemberRemove', async member => {
    const leave = await new discanvas.Leave()
    .setAvatar('https://cdn.discordapp.com/avatars/' + member.id + '/' + member.user.avatar + '.png')
    .setUsername(message.author.username)
    .setDiscriminator(message.author.discriminator)
    .setBackground('BACKGROUND', 'https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg')
    //or : .setBackground('COLOR', '#ff5555')
    .setMainText('Goodbye')
    .setSecondText('Your departure makes us sad')
    /*
    .setCircleColor('#ff5555')
    .setMainTextColor('#ff5555')
    .setSecondTextColor('#ff5555')
    .setPseudoColor('#ff5555')
    */
    .toLeave()

    member.guild.channels.cache.get('channelId').send({ content: 'Goodbye ' + member.toString(), files: [{ attachment: leave.toBuffer(), name: 'leave-' + member.id + '.png' }] });
});

client.login('YOUR_TOKEN');

img

Server Support

Discord Banner

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.4.9

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago