Re-Initialize now refreshes tools.lua

pull/1/head
Astoria Floyd 3 years ago
parent 7510a780a0
commit d26ecf2c63

@ -1,13 +1,13 @@
local discordia = require('discordia')
local client = discordia.Client()
local tools = require("./tools.lua")
Tools = dofile("./tools.lua")
discordia.extensions()
--Setup bot here, initializes bot
client:once("ready", function()
client:setGame("Astoria's bot, very sad!")
print('Logged in as '.. client.user.username)
Commands = tools.initialize()
Commands = Tools.initialize()
end)
--Command handler
@ -22,10 +22,16 @@ client:on('messageCreate', function(message)
end)
client:on('messageCreate', function(message)
if tools.messageDectection(message, "reinitialize") == true then
Commands = tools.initialize()
message:reply("Re-Initialized!")
end
local user = message.guild:getMember(message.author.id)
if not user:hasPermission("administrator") then
message:reply("You cannot re-initialize this bot!")
else
if Tools.messageDectection(message, "reinitialize") == true then
Commands = Tools.initialize()
Tools = dofile("./tools.lua")
message:reply("Re-Initialized!")
end
end
end)
--When a user is banned, post a lenney.

@ -15,7 +15,7 @@ function tools.initialize()
local simpleCommands = simpleCommands.initialize()
local commands = tools.tableMerge(simpleCommands, complexCommands)
return commands
end
end
--Reads an entire file, outputs as string.
function tools.printFile(file)

Loading…
Cancel
Save