forked from funnbot/Nitro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpunch.js
More file actions
37 lines (35 loc) · 1.62 KB
/
Copy pathpunch.js
File metadata and controls
37 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const jimp = require('jimp');
exports.run = (message, bot) => {
if (!message.mentions.users.first()) return message.channel.send("Good job you punched the air, maybe try mentioning someone next time.")
let authorURL = message.author.displayAvatarURL.endsWith(".webp") ? message.author.displayAvatarURL.slice(0, -5) + ".png" : message.author.displayAvatarURL;
let targetPerson = message.mentions.users.first()
let targetURL = targetPerson.displayAvatarURL.endsWith(".webp") ? targetPerson.displayAvatarURL.slice(0, -5) + ".png" : targetPerson.displayAvatarURL;
jimp.read("https://image.freepik.com/free-icon/person-fight-punch_318-29637.jpg", (err, image) => {
if (err) return console.log(err);
jimp.read(authorURL, (err, author) => {
if (err) return console.log(err);
author.resize(100, 100);
jimp.read(targetURL, (err, target) => {
if (err) return console.log(err);
target.resize(100, 100);
target.rotate(-4)
image.composite(author, 110, 30);
image.composite(target, 400, 40);
image.getBuffer(jimp.AUTO, (err, buff) => {
if (err) return console.log(err);
message.channel.send(`**${message.author.username}** *sucker punches* **${message.mentions.users.first().username}**`);
message.channel.sendFile(buff);
})
})
})
})
}
exports.conf = {
userPerm: [],
botPerm: ["SEND_MESSAGES"],
coolDown: 0,
dm: true,
category: "Fun",
help: "Sucker punch a user",
args: "",
}