horse vor 4 Jahren
Ursprung
Commit
f8117d9f16
3 geänderte Dateien mit 30 neuen und 4 gelöschten Zeilen
  1. 22 3
      bot/src/commands/facemorph.ts
  2. 2 1
      bot/src/commands/help.ts
  3. 6 0
      bot/src/main.ts

+ 22 - 3
bot/src/commands/facemorph.ts

@@ -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}`));
     }
 

+ 2 - 1
bot/src/commands/help.ts

@@ -19,7 +19,8 @@ export class Help {
                 baseCommands = `${baseCommands}${doc.example} - ${doc.doc}\n`;
         }
 
-        let message = `Hello! I am NoctBot! My job is to help with C(O)M-related problems!\nPing me with one of the following commands:\n\`\`\`${baseCommands}\`\`\``;
+        let name = process.env.FOOLS == "TRUE" ? "HorseBot" : "NoctBot";
+        let message = `Hello! I am ${name}! My job is to help with C(O)M-related problems!\nPing me with one of the following commands:\n\`\`\`${baseCommands}\`\`\``;
 
         if (isAuthed)
             message = `${msg.author.toString()} ${message}\n👑**Moderator commands**👑\n\`\`\`${modCommands}\`\`\``;

+ 6 - 0
bot/src/main.ts

@@ -66,6 +66,12 @@ client.on("message", async m => {
     if (m.author.id == client.user.id)
         return;
 
+    if(process.env.FOOLS == "TRUE" && (m.channel.id == "297109482905796608" || m.channel.id == "429295461099110402") && Math.random() <= 0.01) {
+        const neighs = ["*NEIGH*", "neeeeeigh!", "Gimme carrots!", "NEEEEIIIIGH", "**N E I G H**"];
+        await m.channel.send(neighs[Math.floor(Math.random() * neighs.length)]);
+        return;
+    }
+
     let content = m.cleanContent.trim();
 
     if (await trigger(mCmd.ActionType.MESSAGE, m, content))