diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-09-13 14:37:09 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-09-13 14:37:09 +0200 |
commit | 09a99db3ef9e122376cc496f1222aa3981e57428 (patch) | |
tree | 4ab3d9c8ca5db358fbe1f51489f2b8905df03b37 /bot.lua | |
parent | 35a58c7c70287b59530d9164b28c9eceb56f81ba (diff) | |
download | furrybot-09a99db3ef9e122376cc496f1222aa3981e57428.tar.xz |
Add uwu command
Diffstat (limited to 'bot.lua')
-rw-r--r-- | bot.lua | 35 |
1 files changed, 22 insertions, 13 deletions
@@ -58,9 +58,12 @@ function furrybot.reload() if func then local old_fb = table.copy(furrybot) local status, init = pcall(func) + if status then - init(http, env, storage) - else + status, init = init(http, env, storage) + end + + if not status then furrybot = old_fb return false, furrybot.colors.error .. "Error: " .. furrybot.colors.detail .. init end @@ -195,20 +198,26 @@ end function furrybot.commands.cmd() end --- send load message -furrybot.send("FurryBot - " .. C("#170089") .. "https://github.com/EliasFleckenstein03/furrybot", furrybot.colors.system) - -if furrybot.loaded then - furrybot.send("Reloaded", furrybot.colors.system) -else - furrybot.loaded = true -end - return function(_http, _env, _storage) http, env, storage = _http, _env, _storage for _, f in ipairs {"nsfw", "roleplay", "death", "economy", "random", "http"} do - print(f) - env.loadfile("clientmods/furrybot/" .. f .. ".lua")()(http, env, storage) + local func, err = env.loadfile("clientmods/furrybot/" .. f .. ".lua") + + if not func then + return false, err + end + + func()(http, env, storage) end + + furrybot.send("FurryBot - " .. C("#170089") .. "https://github.com/EliasFleckenstein03/furrybot", furrybot.colors.system) + + if furrybot.loaded then + furrybot.send("Reloaded", furrybot.colors.system) + else + furrybot.loaded = true + end + + return true end |