27 lines
770 B
Lua
27 lines
770 B
Lua
|
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
|