-
Notifications
You must be signed in to change notification settings - Fork 0
/
imaging.js
27 lines (23 loc) · 899 Bytes
/
imaging.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const jimp = require("jimp");
const fs = require('fs');
module.exports = {
createWelcomeImage: (user, guild, channel) => {
jimp.read('./pics/welcomerBackground.png').then(function(background){
jimp.read(user.avatarURL).then(function(profPic){
jimp.loadFont(jimp.FONT_SANS_32_BLACK).then(function (font) {
profPic.resize(125, jimp.AUTO)
background.clone()
.composite(profPic, 0, 0)
.print(font, 130, 55, guild.name)
.print(font, 5, 130, `Welcome ${user.username}`)
.print(font, 5, 165, `You are user ${guild.memberCount}`)
.write('./pics/welcomeTemp.png', function(err, image){
channel.send({
files: ['./pics/welcomeTemp.png']
});
});
});
});
});
}
}