diff --git a/assets/json/zalgo.json b/assets/json/zalgo.json new file mode 100644 index 00000000..077d3333 --- /dev/null +++ b/assets/json/zalgo.json @@ -0,0 +1,120 @@ +{ + "up": [ + "̍", + "̎", + "̄", + "̅", + "̿", + "̑", + "̆", + "̐", + "͒", + "͗", + "͑", + "̇", + "̈", + "̊", + "͂", + "̓", + "̈", + "͊", + "͋", + "͌", + "̃", + "̂", + "̌", + "͐", + "̀", + "́", + "̋", + "̏", + "̒", + "̓", + "̔", + "̽", + "̉", + "ͣ", + "ͤ", + "ͥ", + "ͦ", + "ͧ", + "ͨ", + "ͩ", + "ͪ", + "ͫ", + "ͬ", + "ͭ", + "ͮ", + "ͯ", + "̾", + "͛", + "͆", + "̚" + ], + "middle": [ + "̕", + "̛", + "̀", + "́", + "͘", + "̡", + "̢", + "̧", + "̨", + "̴", + "̵", + "̶", + "͜", + "͝", + "͞", + "͟", + "͠", + "͢", + "̸", + "̷", + "͡", + "҉" + ], + "down": [ + "̖", + "̗", + "̘", + "̙", + "̜", + "̝", + "̞", + "̟", + "̠", + "̤", + "̥", + "̦", + "̩", + "̪", + "̫", + "̬", + "̭", + "̮", + "̯", + "̰", + "̱", + "̲", + "̳", + "̹", + "̺", + "̻", + "̼", + "ͅ", + "͇", + "͈", + "͉", + "͍", + "͎", + "͓", + "͔", + "͕", + "͖", + "͙", + "͚", + "̣" + ] +} diff --git a/commands/text-edit/zalgo.js b/commands/text-edit/zalgo.js index a9df4c34..edcf93cd 100644 --- a/commands/text-edit/zalgo.js +++ b/commands/text-edit/zalgo.js @@ -1,5 +1,5 @@ const { Command } = require('discord.js-commando'); -const zalgo = require('zalgolize'); +const zalgo = require('../../assets/json/zalgo'); module.exports = class ZalgoCommand extends Command { constructor(client) { @@ -24,6 +24,21 @@ module.exports = class ZalgoCommand extends Command { } run(msg, { text }) { - return msg.say(zalgo(text)); + let result = ''; + for (let i = 0; i < text.length; i++) { + result += text[i]; + if (text[i].length > 1) continue; + const counts = { + up: Math.floor(Math.random() * 8) + 1, + middle: Math.floor(Math.random() * 3), + down: Math.floor(Math.random() * 8) + 1 + }; + for (const type of Object.keys(counts)) { + const count = counts[type]; + const chars = zalgo[type]; + while (count--) result += chars[Math.floor(Math.random() * chars.length)]; + } + } + return msg.say(result); } }; diff --git a/package.json b/package.json index 6a05022e..5542c772 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "42.15.3", + "version": "42.15.4", "description": "Your personal server companion.", "main": "Shard.js", "scripts": { @@ -39,13 +39,12 @@ "erlpack": "github:discordapp/erlpack", "mathjs": "^3.16.3", "node-opus": "^0.2.7", - "pg": "^6.4.2", + "pg": "^7.3.0", "pg-hstore": "^2.3.2", "sequelize": "^4.11.5", "snekfetch": "^3.4.1", "uws": "^8.14.1", - "xml-js": "^1.4.2", - "zalgolize": "^1.2.4" + "xml-js": "^1.4.2" }, "devDependencies": { "eslint": "^4.7.2",