https://github.com/pauldb09/discanvas
https://github.com/pauldb09/discanvas
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pauldb09/discanvas
- Owner: pauldb09
- Created: 2021-05-12T17:18:50.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-12T17:20:10.000Z (about 5 years ago)
- Last Synced: 2025-06-03T15:58:50.873Z (about 1 year ago)
- Language: JavaScript
- Size: 153 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# discanvas
## From simple image with configurable canvas
### More canvas coming soon
Simple canvas with discanvas
[](https://npmjs.org/discanvas)
[](https://npmjs.org/package/discanvas)
> V1
## Example of code
```js
const discanvas = require('discanvas');
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log('I am ready!')
});
client.on('message', async (message) => {
if (message.content === "!rankcard") {
const rankcard = await new discanvas.RankCard()
.setAvatar(message.author.avatarURL({ format: 'png' }))
.setLevel(1)
.setCurrentXP(200)
.setRequiredXP(400)
.setProgressBar("#ff5555")
.setUsername(message.member.user.username)
.setDiscriminator(message.member.user.discriminator)
.setTop(1)
.setBackground("https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg")
.setSquareOpacity(0.5)
.setBorderColor("#00ff55")
.toCard()
const attachment = new Discord.MessageAttachment(rankcard.toBuffer(), "RankCard.jpg");
message.channel.send(attachment);
}
});
```

```js
client.on('guildMemberAdd', member => {
const welcome = await new discanvas.Welcome()
.setAvatar(member.user.displayAvatarURL({ format: 'png' }))
.setUsername(member.user.tag)
.setBackground("https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg")
.setMainText("Welcome")
.setSecondText(`We are now ${member.guild.memberCount} in the guild !`)
/*
.setCircleColor("#ff5555")
.setMainTextColor("#ff5555")
.setSecondTextColor("#ff5555")
.setPseudoColor("#ff5555")
*/
.toWelcome()
const attachment = new Discord.MessageAttachment(welcome.toBuffer(), "welcome.jpg");
const welcomeChannel = client.channels.cache.get("id channel")
welcomeChannel.send(`Welcome ${member.user.username}`, attachment);
});
```

```js
client.on('guildMemberRemove', member => {
const leave = await new discanvas.Leave()
.setAvatar(member.user.displayAvatarURL({ format: 'png' }))
.setUsername(member.user.tag)
.setBackground("https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg")
.setMainText("Good bye")
.setSecondText("Your departure makes us sad")
/*
.setCircleColor("#ff5555")
.setMainTextColor("#ff5555")
.setSecondTextColor("#ff5555")
.setPseudoColor("#ff5555")
*/
.toLeave()
const attachment = new Discord.MessageAttachment(leave.toBuffer(), "leave.jpg");
const leaveChannel = client.channels.cache.get("id channel")
leaveChannel.send(`Good bye ${member.user.username}`, attachment);
});
client.login('your token');
```

# Server Support
[](https://discord.gg/A59kDPN)