sylveon / discord-ban-appeals

Sample ban appeals page with OAuth2 integration
https://discord-ban-appeal-preview.netlify.app/
MIT License
137 stars 45 forks source link

Add support for blocking users via an environment variable #30

Closed karashiiro closed 2 years ago

karashiiro commented 2 years ago

This allows users to be blocked through a new BLOCKED_USERS environment variable, which takes a comma-separated list of quoted user IDs. In the submission function, this list is just parsed with

JSON.parse(`[${process.env.BLOCKED_USERS || ""}]`)

I could've made it require the square brackets as well, but opted against it for user-friendliness. All of the code in this PR is adapted from a separate fork which is itself adapted from similar upstream code, I just cleaned all of that up a bit for this PR.

As mentioned in #15, this could be expanded upon with a managed DB like DynamoDB or MongoDB Atlas so that blocks can be added through bot commands - this is just a quick-and-easy way to accomplish the same thing in a slightly more limited form.

image

netlify[bot] commented 2 years ago

‼️ Deploy request for discord-ban-appeal-preview rejected. Learn more about Netlify's sensitive variable policy

🔨 Explore the source changes: 6000ca52468f4137200e4340b0beb210213d1ada

karashiiro commented 2 years ago

Updated, how's this?