Advertisement
VHIMXCODE

Untitled

Jan 24th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. client.on('message', function (message, member) {
  2. if (message.author.bot) return;
  3. if (!message.content.startsWith(prefix)) return;
  4. //var mess = message.content.toLowerCase();
  5.  
  6. if(message.content.startsWith(prefix + 'رساله')) {
  7. let command = message.content.split(" ")[0];
  8. command = command.slice(prefix.length);
  9.  
  10. let args = message.content.split(" ").slice(1);
  11.  
  12. var Canvas = require('canvas')
  13. var jimp = require('jimp')
  14.  
  15. var Canvas = require('canvas')
  16. var jimp = require('jimp')
  17.  
  18. const w = ['./img/s2.jpg'];
  19.  
  20. let Image = Canvas.Image,
  21. canvas = new Canvas(802, 404),
  22. ctx = canvas.getContext('2d');
  23. ctx.patternQuality = 'bilinear';
  24. ctx.filter = 'bilinear';
  25. ctx.antialias = 'subpixel';
  26. ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';
  27. ctx.shadowOffsetY = 2;
  28. ctx.shadowBlur = 2;
  29. fs.readFile(`${w[Math.floor(Math.random() * w.length)]}`, function (err, Background) {
  30. if (err) return console.log(err);
  31. let BG = Canvas.Image;
  32. let ground = new Image;
  33. ground.src = Background;
  34. ctx.drawImage(ground, 0, 0, 802, 404);
  35.  
  36. })
  37.  
  38. //zxz
  39.  
  40.  
  41.  
  42. let url = message.author.avatarURL.endsWith(".webp") ? message.author.avatarURL.slice(5, -20) + ".png" : message.author.avatarURL;
  43. jimp.read(url, (err, ava) => {
  44. if (err) return console.log(err);
  45. ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
  46. if (err) return console.log(err);
  47.  
  48. //Avatar
  49. let Avatar = Canvas.Image;
  50. let ava = new Avatar;
  51. ava.src = buf;
  52. ctx.save();
  53.  
  54. ctx.beginPath();
  55. ctx.arc(75, 75, 70, 0, Math.PI*2, true);
  56. ctx.closePath();
  57. ctx.clip();
  58. ctx.drawImage(ava, 0, 0, 150, 150);
  59. ctx.restore();
  60. //wl
  61. ctx.font = '35px Arial Bold';
  62. ctx.fontSize = '40px';
  63. ctx.fillStyle = "#dadada";
  64. ctx.textAlign = "center";
  65.  
  66.  
  67. //ur name
  68. ctx.font = '35px Arial';
  69. ctx.fontSize = '30px';
  70. ctx.fillStyle = "#FFFFFF";
  71. ctx.textAlign = "center";
  72. ctx.fillText(args.join(" "), 370, 190);
  73.  
  74.  
  75.  
  76. ctx.beginPath();
  77. //ctx.lineTo(50, 102);
  78. //ctx.lineTo(50 + te.width, 102);
  79. ctx.stroke();
  80. message.channel.sendFile(canvas.toBuffer());
  81.  
  82.  
  83.  
  84.  
  85.  
  86. })
  87. })
  88.  
  89. }
  90. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement