Consent = {} Consent.setup = { name = "Consent", slug = "consent", desc = "Other modules can use to implement consent based decision making", votes = 0 } Consent.config = { prompt = "Would you like to approve this action?", votes_required = 1 } function Consent:initiate(result) self.result = result for id, member in pairs(self.org.members) do self.org:add_pending_action(self.id, member, "callback") end end function Consent:callback(member) modpol.interactions.binary_poll_user( member, self.config.prompt, function (resp) if resp == "Yes" then self.votes = self.votes + 1 end if self.votes >= self.config.votes_required then self.result() self.org:wipe_pending_actions(self.id) end end ) end modpol.modules.consent = Consent