2
0

example.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --[[
  2. modpol calls this function when someone starts a new request for this module
  3. --]]
  4. function module:initiate(org) {
  5. form = {
  6. {
  7. "name": "to_remove",
  8. "display": "Which user should be removed?",
  9. "type": "drop-down",
  10. "values": org:list_members()
  11. },
  12. {
  13. "name": "reason",
  14. "type": "text-box",
  15. "prompt": "Reason for removing member:"
  16. }
  17. }
  18. return form
  19. }
  20. --[[
  21. modpol prompts the user with this form, and after receiving the data asynchronously
  22. the returned form would look like:
  23. {
  24. "to_remove": luke,
  25. "reason": stealing food
  26. }
  27. based on provided "name" fields and the input given by the user
  28. now module:request is called
  29. --]]
  30. function module:request(form) {
  31. self.data = form
  32. }
  33. --[[
  34. after the module request function runs, modpol will initiate the consent process
  35. if consent is approved, the implement function is called
  36. --]]
  37. function module:implement() {
  38. org:remove_member(self.data.to_remove)
  39. }