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 b5ea8f3bbe bunch of stuff
administration.lua: everything's better; automatic migration.
database.usernames -> database.users. View with /me.
Nicks and lastfm usernames moved to database.users; auto migrate.
2016-03-22 06:16:26 -04:00

28 lines
509 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.users[msg.from.id_str].nickname 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
}