join_org_consent.lua 801 B

1234567891011121314151617181920212223242526272829303132
  1. --- Join org (consent)
  2. -- A simple module that calls a consent process on an org to add a member.
  3. -- Depends on the Consent module.
  4. join_org_consent = {}
  5. join_org_consent.setup = {
  6. name = "Join this org",
  7. slug = "join_org_consent",
  8. desc = "Adds member with consent of all members."
  9. }
  10. function join_org_consent:initiate()
  11. self.org:call_module(
  12. "consent",
  13. self.initiator,
  14. {
  15. prompt = "Allow " .. self.initiator .. " to join?",
  16. votes_required = #self.org.members
  17. },
  18. function ()
  19. self:complete()
  20. end
  21. )
  22. end
  23. function join_org_consent:complete()
  24. self.org:add_member(self.initiator)
  25. print("Added " .. self.initiator .. " to the org.")
  26. end
  27. modpol.modules.join_org_consent = join_org_consent