From bb87ad3dd51463f064f548d8b18d1e027fc86014 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Tue, 16 Aug 2016 13:57:33 +0200 Subject: [PATCH] =?UTF-8?q?flip=5Ftext=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miku/plugins/flip_text.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 miku/plugins/flip_text.lua diff --git a/miku/plugins/flip_text.lua b/miku/plugins/flip_text.lua new file mode 100644 index 0000000..ff5e0df --- /dev/null +++ b/miku/plugins/flip_text.lua @@ -0,0 +1,28 @@ +-- Requires: (sudo) npm install -g flip-text +local flip = {} + +function flip:init(config) + flip.triggers = { + "^/(flip) (.+)$", + "^/(rev) (.+)$" + } + flip.doc = '*/flip* __: Dreht Text auf den Kopf\n*/rev* __ Dreht Text um' +end + +flip.command = 'flip ' + +function flip:action(msg, config, matches) + local command = matches[1] + local text = matches[2] + if text:match('"') then + utilities.send_reply(self, msg, 'Vergiss es!') + return + elseif command == 'flip' then + new_text = run_command('flip "'..text..'"') + elseif command == 'rev' then + new_text = run_command('echo "' .. text .. '" | rev') + end + utilities.send_reply(self, msg, new_text) +end + +return flip \ No newline at end of file