join_org.lua 799 B

123456789101112131415161718192021222324252627282930313233
  1. join_org = {}
  2. function join_org.initiate(initiator, org, result)
  3. modpol.interactions.binary_poll_user(
  4. initiator,
  5. "Would you like to join " .. org.name,
  6. function (resp)
  7. if resp == "Yes" then
  8. org:add_member(initiator)
  9. end
  10. end
  11. )
  12. for i, member in ipairs(org.members) do
  13. org:add_pending_action(
  14. member,
  15. function ()
  16. modpol.interactions.binary_poll_user(
  17. member,
  18. "Let " .. initiator .. " join " .. org.name .. "?",
  19. function (resp)
  20. end
  21. )
  22. end
  23. )
  24. end
  25. if result then result() end
  26. end
  27. modpol.modules.join_org = join_org