modpol/modpol_core/orgs/example.lua

48 lines
1.0 KiB
Lua

--[[
modpol calls this function when someone starts a new request for this module
--]]
function module:initiate(org) {
form = {
{
"name": "to_remove",
"display": "Which user should be removed?",
"type": "drop-down",
"values": org:list_members()
},
{
"name": "reason",
"type": "text-box",
"prompt": "Reason for removing member:"
}
}
return form
}
--[[
modpol prompts the user with this form, and after receiving the data asynchronously
the returned form would look like:
{
"to_remove": luke,
"reason": stealing food
}
based on provided "name" fields and the input given by the user
now module:request is called
--]]
function module:request(form) {
self.data = form
}
--[[
after the module request function runs, modpol will initiate the consent process
if consent is approved, the implement function is called
--]]
function module:implement() {
org:remove_member(self.data.to_remove)
}