This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/miku/plugins/color_hex.lua

27 lines
770 B
Lua
Raw Normal View History

2017-06-26 15:58:48 +02:00
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* _<Code>_: Sendet ein Beispielbild der Farbe]]
end
color_hex.command = 'hex <Code>'
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