chatter.lua now responds to @username as well.

This commit is contained in:
topkecleon 2015-11-26 18:55:57 -05:00
parent 4f191ac57a
commit 326b8b887c

View File

@ -2,13 +2,15 @@
local triggers = {
'',
'^' .. bot.first_name .. ','
'^' .. bot.first_name .. ',',
'^@' .. bot.username .. ','
}
local action = function(msg)
-- This is awkward, but if you have a better way, please share.
if msg.text_lower:match('^' .. bot.first_name .. ',') then
elseif msg.text_lower:match('^@' .. bot.username .. ',') then
elseif msg.reply_to_message and msg.reply_to_message.from.id == bot.id then
elseif msg.from.id == msg.chat.id then
else
@ -17,7 +19,9 @@ local action = function(msg)
sendChatAction(msg.chat.id, 'typing')
local input = msg.text_lower:gsub(bot.first_name, 'simsimi')
local input = msg.text_lower
input = input:gsub(bot.first_name, 'simsimi')
input = input:gsub('@'..bot.username, 'simsimi')
local url = 'http://www.simsimi.com/requestChat?lc=en&ft=1.0&req=' .. URL.escape(input)