Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', function (message, member) {
- if (message.author.bot) return;
- if (!message.content.startsWith(prefix)) return;
- //var mess = message.content.toLowerCase();
- if(message.content.startsWith(prefix + 'رساله')) {
- let command = message.content.split(" ")[0];
- command = command.slice(prefix.length);
- let args = message.content.split(" ").slice(1);
- var Canvas = require('canvas')
- var jimp = require('jimp')
- var Canvas = require('canvas')
- var jimp = require('jimp')
- const w = ['./img/s2.jpg'];
- let Image = Canvas.Image,
- canvas = new Canvas(802, 404),
- ctx = canvas.getContext('2d');
- ctx.patternQuality = 'bilinear';
- ctx.filter = 'bilinear';
- ctx.antialias = 'subpixel';
- ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';
- ctx.shadowOffsetY = 2;
- ctx.shadowBlur = 2;
- fs.readFile(`${w[Math.floor(Math.random() * w.length)]}`, function (err, Background) {
- if (err) return console.log(err);
- let BG = Canvas.Image;
- let ground = new Image;
- ground.src = Background;
- ctx.drawImage(ground, 0, 0, 802, 404);
- })
- //zxz
- let url = message.author.avatarURL.endsWith(".webp") ? message.author.avatarURL.slice(5, -20) + ".png" : message.author.avatarURL;
- jimp.read(url, (err, ava) => {
- if (err) return console.log(err);
- ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
- if (err) return console.log(err);
- //Avatar
- let Avatar = Canvas.Image;
- let ava = new Avatar;
- ava.src = buf;
- ctx.save();
- ctx.beginPath();
- ctx.arc(75, 75, 70, 0, Math.PI*2, true);
- ctx.closePath();
- ctx.clip();
- ctx.drawImage(ava, 0, 0, 150, 150);
- ctx.restore();
- //wl
- ctx.font = '35px Arial Bold';
- ctx.fontSize = '40px';
- ctx.fillStyle = "#dadada";
- ctx.textAlign = "center";
- //ur name
- ctx.font = '35px Arial';
- ctx.fontSize = '30px';
- ctx.fillStyle = "#FFFFFF";
- ctx.textAlign = "center";
- ctx.fillText(args.join(" "), 370, 190);
- ctx.beginPath();
- //ctx.lineTo(50, 102);
- //ctx.lineTo(50 + te.width, 102);
- ctx.stroke();
- message.channel.sendFile(canvas.toBuffer());
- })
- })
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement