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/blacklist.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

41 lines
880 B
Lua

-- Admins can blacklist a user from utilizing this bot. Use via reply or with an ID as an argument. Un-blacklist a user with the same command.
local triggers = {
'^/blacklist'
}
local action = function(msg)
if not config.admins[msg.from.id] then
return send_msg(msg, 'Permission denied.')
end
local input = get_input(msg.text)
if not input then
if msg.reply_to_message then
input = msg.reply_to_message.from.id
else
return send_msg(msg, 'Must be used via reply or by specifying a user\'s ID.')
end
end
local id = tostring(input)
if config.blacklist[id] then
config.blacklist[id] = nil
send_msg(msg, 'User has been removed from the blacklist.')
else
config.blacklist[id] = true
send_msg(msg, 'User has been blacklisted.')
end
save_data('blacklist.json', config.blacklist)
end
return {
doc = doc,
triggers = triggers,
action = action
}