join_org_consent.lua 838 B

123456789101112131415161718192021222324252627282930313233343536
  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. local join_org_consent = {
  5. name = "Join this org",
  6. slug = "join_org_consent",
  7. desc = "Adds member with consent of all members."
  8. }
  9. join_org_consent.data = {
  10. }
  11. join_org_consent.config = {
  12. }
  13. function join_org_consent:initiate()
  14. self.org:call_module(
  15. "consent",
  16. self.initiator,
  17. {
  18. prompt = "Allow " .. self.initiator .. " to join?",
  19. votes_required = #self.org.members
  20. },
  21. function ()
  22. self:complete()
  23. end
  24. )
  25. end
  26. function join_org_consent:complete()
  27. self.org:add_member(self.initiator)
  28. print("Added " .. self.initiator .. " to the org.")
  29. end
  30. modpol.modules.join_org_consent = join_org_consent