Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- const Canvas = require("canvas");
- client.on('ready', () => {
- console.log(`Logged in as ${client.user.tag}!`);
- });
- client.on('message', msg => {
- if (msg.content === 'ping') {
- msg.reply('Pong!');
- }
- });
- client.on("message", message => {
- if (message.author.bot) return;
- if(!message.channel.guild) return;
- let args = message.content.split(' ').slice(1).join(' ');
- if(message.content.split(' ')[0] == prefix + 'pbc') {
- if (!args[1]) {
- message.channel.send(":white_check_mark: ***pbc <message>***");
- return;
- }
- message.guild.members.forEach(member => {
- if(!message.member.hasPermission('ADMINISTRATOR')) return;
- message.react("✅");
- const w = ['./bc/1.png',
- './bc/2.png',
- './bc/3.png',
- './bc/4.png',
- './bc/5.png',
- './bc/6.png',
- './bc/7.png',];
- let Image = Canvas.Image,
- canvas = new Canvas(400, 200),
- 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, 400, 200);
- });
- let url = member.user.displayAvatarURL.endsWith(".webp") ? member.user.displayAvatarURL.slice(5, -20) + ".png" : member.user.displayAvatarURL;
- jimp.read(url, (err, ava) => {
- if (err) return console.log(err);
- ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
- if (err) return console.log(err);
- ctx.font = '17px Arial';
- ctx.fontSize = '13px';
- ctx.fillStyle = "#FFFFFF";
- ctx.textAlign = "center";
- ctx.fillText(`${args} ` , 200, 100);
- member.sendFile(canvas.toBuffer());
- });
- });
- });
- }
- });
- client.login("Token here");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement