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/plugins/greetings.lua
topkecleon 02a7d411fa Database is now centralized. All data is stored in tables within the database table,
which is automatically saved. Please be sure to always stop the bot with /halt to
prevent data loss.
2016-02-21 14:28:40 -05:00

28 lines
504 B
Lua
Executable File

-- Put this on the bottom of your plugin list, after help.lua.
local triggers = {
bot.first_name .. '%p?$'
}
local action = function(msg)
local nick = database.nicknames[msg.from.id_str] or msg.from.first_name
for k,v in pairs(config.greetings) do
for key,val in pairs(v) do
if msg.text_lower:match(val..',? '..bot.first_name) then
sendMessage(msg.chat.id, latcyr(k:gsub('#NAME', nick)))
return
end
end
end
return true
end
return {
action = action,
triggers = triggers
}