For photo messages, bot will look for commands in the caption if available.
Fixed bug in chatter.lua where the bot will attempt to reply to photo messages.
This commit is contained in:
parent
faa86ab8fd
commit
4bd0a72b5a
2
bot.lua
2
bot.lua
@ -37,7 +37,7 @@ end
|
|||||||
|
|
||||||
on_msg_receive = function(msg) -- The fn run whenever a message is received.
|
on_msg_receive = function(msg) -- The fn run whenever a message is received.
|
||||||
|
|
||||||
if not msg.text then msg.text = '' end -- So about.lua works.
|
if not msg.text then msg.text = msg.caption or '' end -- So about.lua works.
|
||||||
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.
|
||||||
|
|
||||||
msg.chat.id_str = tostring(msg.chat.id)
|
msg.chat.id_str = tostring(msg.chat.id)
|
||||||
|
@ -8,6 +8,8 @@ local triggers = {
|
|||||||
|
|
||||||
local action = function(msg)
|
local action = function(msg)
|
||||||
|
|
||||||
|
if msg.text == '' then return end
|
||||||
|
|
||||||
-- This is awkward, but if you have a better way, please share.
|
-- This is awkward, but if you have a better way, please share.
|
||||||
if msg.text_lower:match('^' .. bot.first_name .. ',') then
|
if msg.text_lower:match('^' .. bot.first_name .. ',') then
|
||||||
elseif msg.text_lower:match('^@' .. bot.username .. ',') then
|
elseif msg.text_lower:match('^@' .. bot.username .. ',') then
|
||||||
|
Reference in New Issue
Block a user