modpol/modpol_core/modules/remove_org.lua
2021-12-18 20:41:49 -07:00

34 lines
786 B
Lua

--- @module Remove Org
-- A simple module that removes an org.
--- Main module table
remove_org = {
name = "Remove this org",
slug = "remove_org",
desc = "Removes an org if all members consent."
}
remove_org.config = {}
remove_org.data = {}
--- Initiate function
-- @function initiate
function remove_org:initiate(result)
if self.org == modpol.instance then
modpol.interactions.message(
self.initiator,
"You cannot remove the root org")
else
modpol.interactions.message_org(
self.initiator,self.org.id,
"Removing org: "..self.org.name)
self.org:delete()
modpol.interactions.dashboard(self.initiator)
-- call result function
end
if result then result() end
end
modpol.modules.remove_org = remove_org