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/admin.lua
topkecleon a1a4978a1b config, locale in lua
personality.lua -> interactions.lua
innumerable improvements
2015-07-15 02:15:23 -04:00

52 lines
884 B
Lua

local PLUGIN = {}
PLUGIN.triggers = {
'^/admin '
}
function PLUGIN.action(msg)
if msg.date < os.time() - 1 then return end
local input = get_input(msg.text)
local message = config.locale.errors.argument
local sudo = 0
for i,v in ipairs(config.admins) do
if msg.from.id == v then
sudo = v
end
end
if sudo == 0 then
message = 'Permission denied.'
elseif string.lower(first_word(input)) == 'run' then
local output = get_input(input)
if not output then
return send_msg(msg, config.locale.errors.argument)
end
local output = io.popen(output)
message = output:read('*all')
output:close()
elseif string.lower(first_word(input)) == 'reload' then
bot_init()
message = 'Bot reloaded!'
elseif string.lower(first_word(input)) == 'halt' then
is_started = false
message = 'Shutting down...'
end
send_msg(msg, message)
end
return PLUGIN