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/nick.lua
topkecleon 4c72543315 no typing by default
various bugfixes
blacklisting support (blacklist.lua)
	json file created automatically
	users are blacklisted and unblacklisted via reply with /blacklist
nicknames support (nick.lua)
	json file created automatically
	users set nick by /nick
	"people" section of config deprecated
moderation.lua improvements
	administrators can now run mod commands
	administrators are now listed with moderators
	modlist improved to be smarter and look better
	administrators can no longer be promoted to moderator
	/hammer command for admins to perform realm-wide ban
2015-08-18 05:55:25 -04:00

30 lines
493 B
Lua

local doc = [[
/nick <nickname>
Set your nickname for the bot to call you.
]]
local triggers = {
'^/nick'
}
local action = function(msg)
local data = load_data('nicknames.json')
local id = tostring(msg.from.id)
local input = get_input(msg.text)
if not input then
return send_msg(msg, doc)
end
data[id] = input
save_data('nicknames.json', data)
send_msg(msg, 'Your nickname has been set to ' .. input .. '.')
end
return {
doc = doc,
triggers = triggers,
action = action
}