support replied message's captions instead of text

This commit is contained in:
JuanPotato 2016-04-03 15:18:25 -04:00
parent 76f80316c4
commit bcb2fc630d

View File

@ -73,6 +73,10 @@ on_msg_receive = function(msg) -- The fn run whenever a message is received.
if msg.date < os.time() - 5 then return end -- Do not process old messages. if msg.date < os.time() - 5 then return end -- Do not process old messages.
if not msg.text then msg.text = msg.caption or '' end if not msg.text then msg.text = msg.caption or '' end
if msg.reply_to_message and msg.reply_to_message.caption then
msg.reply_to_message.text = msg.reply_to_message.caption
end -- If the reply_to_msg contains a caption, set it as its text
if msg.text:match('^/start .+') then if msg.text:match('^/start .+') then
msg.text = '/' .. msg.text:input() msg.text = '/' .. msg.text:input()
end end