12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- -- JOIN ORG
- -- Module that enables a user to join an org
- JoinOrg = {}
- JoinOrg_mt = { __index = JoinOrg }
- function JoinOrg.create(initiator, org)
- local inst = {
- name = "Join an org",
- desc = "Initiator chooses an org to become a member of. Nothing happens if they are already in an org.",
- initiator = initiator,
- org = org
- }
- setmetatable(inst, JoinOrg_mt)
- return inst
- end
- function JoinOrg:initiate(result)
- modpol.interactions.binary_poll_user(
- self.initiator,
- "Would you like to join",
- function (resp)
- if resp == "Yes" then
- self:implement()
- end
- end
- )
- if result then result() end
- end
- function JoinOrg:request()
- end
- function JoinOrg:implement()
- self.org:add_member(self.initiator)
- end
- -- ===================================
- -- When calling a module internally
- modpol.modules.join_org_class = JoinOrg
|