|
@@ -35,11 +35,19 @@ export class Facemorph {
|
|
|
morphFaces = async (faces: cv.Rect[], data: Buffer) => {
|
|
|
let padoru = Math.random() <= this.getPadoruChance();
|
|
|
let jimpImage = await Jimp.read(data);
|
|
|
- let emojiKeys = [
|
|
|
+ let emojiKeys = process.env.FOOLS != "TRUE" ? [
|
|
|
...client.guilds
|
|
|
.get(EMOTE_GUILD)
|
|
|
.emojis.filter(e => !e.animated && e.name.startsWith("PADORU") == padoru)
|
|
|
.keys()
|
|
|
+ ]:
|
|
|
+ [
|
|
|
+ "505335829565276160",
|
|
|
+ "430434087157760003",
|
|
|
+ "456472341874999297",
|
|
|
+ "649677767348060170",
|
|
|
+ "589706788782342183",
|
|
|
+ "665272109227835422"
|
|
|
];
|
|
|
|
|
|
for (const rect of faces) {
|
|
@@ -96,7 +104,15 @@ export class Facemorph {
|
|
|
tempImg = await tempImg.scale(targetSize / squaredFace.width);
|
|
|
|
|
|
let font = await Jimp.loadFont(padoru ? Jimp.FONT_SANS_16_WHITE : Jimp.FONT_SANS_16_BLACK);
|
|
|
- let text = padoru ? "PADORU PADORU" : `${(await this.getRandomCaption(FaceCaptionType.PREFIX)).message} ${(await this.getRandomCaption(FaceCaptionType.POSTFIX)).message}`;
|
|
|
+ let text = "";
|
|
|
+ if(padoru)
|
|
|
+ text = "PADORU PADORU";
|
|
|
+ else if(process.env.FOOLS == "TRUE") {
|
|
|
+ const titles = ["They are horse", "Neigh!", "Insert carrots into them!", "They will become horse!", "They will serve Geoffrey!", "tfw no carrots"];
|
|
|
+ text = titles[Math.floor(Math.random() * titles.length)];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ text = `${(await this.getRandomCaption(FaceCaptionType.PREFIX)).message} ${(await this.getRandomCaption(FaceCaptionType.POSTFIX)).message}`;
|
|
|
let h = Jimp.measureTextHeight(font, text, targetSize - CAPTION_OFFSET * 2);
|
|
|
let finalImage = await Jimp.create(targetSize, targetSize + h + CAPTION_OFFSET * 2, padoru ? "#FD2027" : "#FFFFFF");
|
|
|
|
|
@@ -203,12 +219,15 @@ export class Facemorph {
|
|
|
|
|
|
let image = lastImagedMessage.attachments.find(v => isValidImage(v.filename));
|
|
|
|
|
|
+ let replyEmoji = client.emojis.get("505076258753740810");
|
|
|
+ let emojiText = replyEmoji ? replyEmoji.toString() : "Jiiii~";
|
|
|
+
|
|
|
this.processFaceSwap(
|
|
|
msg,
|
|
|
image.url,
|
|
|
processor,
|
|
|
`${msg.author.toString()} Nice image! I don't see anything interesting, though.`,
|
|
|
- `${msg.author.toString()} ${client.emojis.get("505076258753740810").toString()}`
|
|
|
+ `${msg.author.toString()} ${emojiText}`
|
|
|
).catch(err => console.log(`Failed to run faceapp because ${err}`));
|
|
|
}
|
|
|
|