]> git.lizzy.rs Git - furrybot-discord.git/blobdiff - badapple.js
Add bad apple
[furrybot-discord.git] / badapple.js
diff --git a/badapple.js b/badapple.js
new file mode 100644 (file)
index 0000000..c8b56c5
--- /dev/null
@@ -0,0 +1,21 @@
+const badapple = require("./badapple.json")
+
+module.exports = {
+       badapple: {
+               operator: true,
+               func: msg => msg.reply("loading...")
+                       .then(canvas => {
+                               const frames = badapple.frames.map(frame => "```\n" + frame + "```")
+                               
+                               const iv = setInterval(_ => {
+                                       const frame = frames.shift()
+                               
+                                       if (frame)
+                                               canvas.edit(frame)
+                                       else
+                                               clearInterval(iv)
+                                       
+                               }, 1000 / badapple.fps)
+                       })
+       }
+}