module.exports = class { onCreate() { this.state = { permitted: false } } onInput(input) { if (!input.user || !input.user.loggedIn) { this.state.permitted = input.not return } if (input.author != null && input.author != "" && input.user.name === input.author) { this.state.permitted = input.user.permissions.includes("member") } else if (Array.isArray(input.permission)) { this.state.permitted = input.user.permissions.find(p => input.permission.includes(p)) } else { this.state.permitted = input.user.permissions.includes(input.permission) } // Flip the above permission if (input.not) { this.state.permitted = !this.state.permitted } } }