config.lua inside data folder
This commit is contained in:
parent
6c9efc902c
commit
a0a3c771f8
17
bot/bot.lua
17
bot/bot.lua
@ -119,20 +119,21 @@ end
|
|||||||
|
|
||||||
-- Save the content of _config to config.lua
|
-- Save the content of _config to config.lua
|
||||||
function save_config( )
|
function save_config( )
|
||||||
serialize_to_file(_config, './bot/config.lua')
|
serialize_to_file(_config, './data/config.lua')
|
||||||
print ('saved config into ./bot/config.lua')
|
print ('saved config into ./data/config.lua')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function load_config( )
|
function load_config( )
|
||||||
local f = io.open('./bot/config.lua', "r")
|
local f = io.open('./data/config.lua', "r")
|
||||||
-- If config.lua doesnt exists
|
-- If config.lua doesnt exists
|
||||||
if not f then
|
if not f then
|
||||||
print ("Created new config file: bot/config.lua")
|
print ("Created new config file: data/config.lua")
|
||||||
create_config()
|
create_config()
|
||||||
|
else
|
||||||
|
f:close()
|
||||||
end
|
end
|
||||||
f:close()
|
local config = loadfile ("./data/config.lua")()
|
||||||
local config = loadfile ("./bot/config.lua")()
|
|
||||||
for v,user in pairs(config.sudo_users) do
|
for v,user in pairs(config.sudo_users) do
|
||||||
print("Allowed user: " .. user)
|
print("Allowed user: " .. user)
|
||||||
end
|
end
|
||||||
@ -159,8 +160,8 @@ function create_config( )
|
|||||||
"youtube" },
|
"youtube" },
|
||||||
sudo_users = {our_id}
|
sudo_users = {our_id}
|
||||||
}
|
}
|
||||||
serialize_to_file(config, './bot/config.lua')
|
serialize_to_file(config, './data/config.lua')
|
||||||
print ('saved config into ./bot/config.lua')
|
print ('saved config into ./data/config.lua')
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_our_id (id)
|
function on_our_id (id)
|
||||||
|
Reference in New Issue
Block a user