message_org.lua 1008 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --- Messages all org members
  2. -- @module message_org
  3. local message_org = {
  4. name = "Message org",
  5. slug = "message_org",
  6. desc = "Send a message to all members of the org",
  7. hide = false;
  8. }
  9. message_org.data = {
  10. }
  11. message_org.config = {
  12. }
  13. --- Allows user to send input message to all org members
  14. -- @function initiate
  15. -- @param result Callback if this module is embedded in other modules
  16. function message_org:initiate(result)
  17. modpol.interactions.text_query(
  18. self.initiator, "Message to all org members: ",
  19. function(input)
  20. local message = self.initiator.." to org "..
  21. self.org.name..": "..input
  22. if input and input ~= "" then
  23. modpol.interactions.message_org(
  24. self.initiator, self.org.id, message)
  25. end
  26. modpol.interactions.org_dashboard(
  27. self.initiator, self.org.id)
  28. end
  29. )
  30. if result then result() end
  31. self.org:delete_process(self.id)
  32. end
  33. modpol.modules.message_org = message_org