From ebb702cefaf7e246e24b11575262c045801a4afb Mon Sep 17 00:00:00 2001 From: Akamaru Date: Mon, 26 Jun 2017 15:58:48 +0200 Subject: [PATCH] Neues Plugin: Color HEX --- miku/plugins/color_hex.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 miku/plugins/color_hex.lua diff --git a/miku/plugins/color_hex.lua b/miku/plugins/color_hex.lua new file mode 100644 index 0000000..f4a8ff6 --- /dev/null +++ b/miku/plugins/color_hex.lua @@ -0,0 +1,26 @@ +local color_hex = {} + +function color_hex:init(config) + color_hex.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('[Hh][Ee][Xx]', true).table + color_hex.doc = [[* +]]..config.cmd_pat..[[hex* __: Sendet ein Beispielbild der Farbe]] +end + +color_hex.command = 'hex ' + +function color_hex:action(msg, config, matches) + local input = utilities.input(msg.text) + if not input then + if msg.reply_to_message and msg.reply_to_message.text then + input = msg.reply_to_message.text + else + utilities.send_message(msg.chat.id, color_hex.doc, true, msg.message_id, true) + return + end + end + + local img = 'https://www.beautycolorcode.com/'..input..'.png' + utilities.send_photo(msg.chat.id, img, nil, msg.message_id) +end + +return color_hex