Advertisement
n3k4a

BC - PIC BY N34KA

Aug 31st, 2019
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const client = new Discord.Client();
  3. const Canvas = require("canvas");
  4.  
  5.  
  6. client.on('ready', () => {
  7. console.log(`Logged in as ${client.user.tag}!`);
  8. });
  9.  
  10. client.on('message', msg => {
  11. if (msg.content === 'ping') {
  12. msg.reply('Pong!');
  13. }
  14. });
  15. client.on("message", message => {
  16. if (message.author.bot) return;
  17. if(!message.channel.guild) return;
  18. let args = message.content.split(' ').slice(1).join(' ');
  19. if(message.content.split(' ')[0] == prefix + 'pbc') {
  20. if (!args[1]) {
  21. message.channel.send(":white_check_mark: ***pbc <message>***");
  22. return;
  23. }
  24. message.guild.members.forEach(member => {
  25. if(!message.member.hasPermission('ADMINISTRATOR')) return;
  26. message.react("✅");
  27. const w = ['./bc/1.png',
  28. './bc/2.png',
  29. './bc/3.png',
  30. './bc/4.png',
  31. './bc/5.png',
  32. './bc/6.png',
  33. './bc/7.png',];
  34. let Image = Canvas.Image,
  35. canvas = new Canvas(400, 200),
  36. ctx = canvas.getContext('2d');
  37. ctx.patternQuality = 'bilinear';
  38. ctx.filter = 'bilinear';
  39. ctx.antialias = 'subpixel';
  40. ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';
  41. ctx.shadowOffsetY = 2;
  42. ctx.shadowBlur = 2;
  43. fs.readFile(`${w[Math.floor(Math.random() * w.length)]}`, function (err, Background) {
  44. if (err) return console.log(err);
  45. let BG = Canvas.Image;
  46. let ground = new Image;
  47. ground.src = Background;
  48. ctx.drawImage(ground, 0, 0, 400, 200);
  49.  
  50. });
  51. let url = member.user.displayAvatarURL.endsWith(".webp") ? member.user.displayAvatarURL.slice(5, -20) + ".png" : member.user.displayAvatarURL;
  52. jimp.read(url, (err, ava) => {
  53. if (err) return console.log(err);
  54. ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
  55. if (err) return console.log(err);
  56.  
  57. ctx.font = '17px Arial';
  58. ctx.fontSize = '13px';
  59. ctx.fillStyle = "#FFFFFF";
  60. ctx.textAlign = "center";
  61. ctx.fillText(`${args} ` , 200, 100);
  62. member.sendFile(canvas.toBuffer());
  63. });
  64. });
  65. });
  66. }
  67. });
  68.  
  69. client.login("Token here");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement