Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.78 KB | None | 0 0
  1. client.on('message', message => {
  2. if(message.content == ('!profile')) {
  3.  
  4. if (message.channel.type === 'dm') return message.reply('This Command Is Not Avaible In Dm\'s :x:');
  5. var Canvas = module.require('canvas');
  6. var jimp = module.require('jimp');
  7.  
  8. const w = ['ID1.png','ID2.png','ID3.png','ID4.png','ID5.png'];
  9.  
  10. let Image = Canvas.Image,
  11. canvas = Canvas.createCanvas(802, 404),
  12. ctx = canvas.getContext('2d');
  13. ctx.patternQuality = 'bilinear';
  14. ctx.filter = 'bilinear';
  15. ctx.antialias = 'subpixel';
  16. ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';
  17. ctx.shadowOffsetY = 2;
  18. ctx.shadowBlur = 2;
  19. fs.readFile(`${w[Math.floor(Math.random() * w.length)]}`, function (err, Background) {
  20. if (err) return console.log(err);
  21. let BG = Canvas.Image;
  22. let ground = new Image;
  23. ground.src = Background;
  24. ctx.drawImage(ground, 0, 0, 802, 404);
  25.  
  26. })
  27. let user = message.mentions.users.first();
  28. var men = message.mentions.users.first();
  29. var heg;
  30. if(men) {
  31. heg = men
  32. } else {
  33. heg = message.author
  34. }
  35. var mentionned = message.mentions.members.first();
  36. var h;
  37. if(mentionned) {
  38. h = mentionned
  39. } else {
  40. h = message.member
  41. }
  42. var ment = message.mentions.users.first();
  43. var getvalueof;
  44. if(ment) {
  45. getvalueof = ment;
  46. } else {
  47. getvalueof = message.author;
  48. }//ما خصك ,_,
  49. let url = getvalueof.displayAvatarURL.endsWith(".webp") ? getvalueof.displayAvatarURL.slice(5, -20) + ".png" : getvalueof.displayAvatarURL;
  50. jimp.read(url, (err, ava) => {
  51. if (err) return console.log(err);
  52. ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
  53. if (err) return console.log(err);
  54.  
  55. let Avatar = Canvas.Image;
  56. let ava = new Avatar;
  57. ava.src = buf;
  58. ctx.beginPath();
  59. ctx.drawImage(ava, 335, 3, 160, 169);
  60. ctx.font = '35px Arial Bold';
  61. ctx.fontSize = '40px';
  62. ctx.fillStyle = "#dadada";
  63. ctx.textAlign = "center";
  64.  
  65.  
  66. ctx.font = '30px Arial Bold';
  67. ctx.fontSize = '30px';
  68. ctx.fillStyle = "#ffffff";
  69. ctx.fillText(`${getvalueof.username}`,655, 170);
  70.  
  71.  
  72. moment.locale('ar-ly');
  73.  
  74.  
  75. ctx.font = '30px Arial';
  76. ctx.fontSize = '30px';
  77. ctx.fillStyle = "#ffffff";
  78. ctx.fillText(`${moment(h.joinedAt).fromNow()}`,150, 305);
  79.  
  80.  
  81. ctx.font = '30px Arial';
  82. ctx.fontSize = '30px';
  83. ctx.fillStyle = "#ffffff";
  84. ctx.fillText(`${moment(heg.createdTimestamp).fromNow()}`,150, 170);
  85.  
  86. let status;
  87. if (getvalueof.presence.status === 'online') {
  88. status = 'Online';
  89. } else if (getvalueof.presence.status === 'dnd') {
  90. status = 'dnd';
  91. } else if (getvalueof.presence.status === 'idle') {
  92. status = 'idle';
  93. } else if (getvalueof.presence.status === 'offline') {
  94. status = 'offline';
  95. }
  96.  
  97.  
  98. ctx.cont = '35px Arial';
  99. ctx.fontSize = '30px';
  100. ctx.filleStyle = '#ffffff'
  101. ctx.fillText(`${status}`,655,305)
  102.  
  103. ctx.font = 'regular 30px Cairo';
  104. ctx.fontSize = '30px';
  105. ctx.fillStyle = '#ffffff'
  106. ctx.fillText(`${h.presence.game === null ? "No playing" : h.presence.game.name}`,390,390);
  107.  
  108. ctx.font = '35px Arial';
  109. ctx.fontSize = '30px';
  110. ctx.fillStyle = '#ffffff'
  111. ctx.fillText(`#${heg.discriminator}`,390,260)
  112.  
  113. ctx.beginPath();
  114. ctx.stroke();
  115. message.channel.sendFile(canvas.toBuffer());
  116.  
  117.  
  118.  
  119.  
  120. })
  121.  
  122. })
  123. }
  124. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement