Updated plugin plugins.lua
Save reenabled plugin on data/config.lua Changed filename to plugin_name
This commit is contained in:
parent
b2b41f2311
commit
5982738514
@ -48,20 +48,22 @@ local function reload_plugins( )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function enable_plugin( filename )
|
local function enable_plugin( plugin_name )
|
||||||
|
print('checking if '..plugin_name..' exists')
|
||||||
-- Check if plugin is enabled
|
-- Check if plugin is enabled
|
||||||
if plugin_enabled(filename) then
|
if plugin_enabled(plugin_name) then
|
||||||
return 'Plugin '..filename..' ist aktiviert!'
|
return 'Plugin '..plugin_name..' ist aktiviert!'
|
||||||
end
|
end
|
||||||
-- Checks if plugin exists
|
-- Checks if plugin exists
|
||||||
if plugin_exists(filename) then
|
if plugin_exists(plugin_name) then
|
||||||
-- Add to the config table
|
-- Add to the config table
|
||||||
table.insert(_config.enabled_plugins, filename)
|
table.insert(_config.enabled_plugins, plugin_name)
|
||||||
|
print(plugin_name..' added to _config table')
|
||||||
save_config()
|
save_config()
|
||||||
-- Reload the plugins
|
-- Reload the plugins
|
||||||
return reload_plugins( )
|
return reload_plugins( )
|
||||||
else
|
else
|
||||||
return 'Das Plugin '..filename..' exestiert nicht!'
|
return 'Das Plugin '..plugin_name..' exestiert nicht!'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -114,6 +116,7 @@ local function reenable_plugin_on_chat(receiver, plugin)
|
|||||||
end
|
end
|
||||||
|
|
||||||
_config.disabled_plugin_on_chat[receiver][plugin] = false
|
_config.disabled_plugin_on_chat[receiver][plugin] = false
|
||||||
|
save_config()
|
||||||
return 'Das Plugin '..plugin..' ist wieder aktiviert!'
|
return 'Das Plugin '..plugin..' ist wieder aktiviert!'
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -134,7 +137,7 @@ local function run(msg, matches)
|
|||||||
-- Enable a plugin
|
-- Enable a plugin
|
||||||
if matches[1] == 'enable' then
|
if matches[1] == 'enable' then
|
||||||
print("enable: "..matches[2])
|
print("enable: "..matches[2])
|
||||||
return enable_plugin(matches[2])
|
return enable_plugin(plugin_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Disable a plugin on a chat
|
-- Disable a plugin on a chat
|
||||||
@ -164,8 +167,8 @@ return {
|
|||||||
"^/plugins$",
|
"^/plugins$",
|
||||||
"^/plugins? (enable) ([%w_%.%-]+)$",
|
"^/plugins? (enable) ([%w_%.%-]+)$",
|
||||||
"^/plugins? (disable) ([%w_%.%-]+)$",
|
"^/plugins? (disable) ([%w_%.%-]+)$",
|
||||||
"^/plugins? (disable) ([%w_%.%-]+) (chat)",
|
|
||||||
"^/plugins? (enable) ([%w_%.%-]+) (chat)",
|
"^/plugins? (enable) ([%w_%.%-]+) (chat)",
|
||||||
|
"^/plugins? (disable) ([%w_%.%-]+) (chat)",
|
||||||
"^/plugins? (reload)$" },
|
"^/plugins? (reload)$" },
|
||||||
run = run,
|
run = run,
|
||||||
privileged = true
|
privileged = true
|
||||||
|
Reference in New Issue
Block a user