ServerGuardBot is a Discord bot designed to verify that users are present on one or more required servers using OAuth2 authorization. It ensures users meet the necessary server membership requirements before granting access.
- OAuth2 Integration: Verifies user presence in required servers as configured.
- Automated Access Management: Grants server access upon successful OAuth2 authorization.
-
Create a Discord Application:
- Go to the Discord Developer Portal.
- Click on "New Application" and give it a name.
- Go to the "Bot" tab and click "Add Bot." Confirm by clicking "Yes, do it!"
-
Get Your Bot Token:
- Under the "Bot" tab, you will see a "Token" section. Click "Copy" to save your token. You'll need this for your
.env
file.
- Under the "Bot" tab, you will see a "Token" section. Click "Copy" to save your token. You'll need this for your
-
Configure OAuth2 Settings:
- Go to the "OAuth2" tab in your application.
- Under "OAuth2 URL Generator," select the scopes
identify
andguilds
. - In the "OAuth2 Redirects" section, add the redirect URI where your bot will handle the OAuth2 response (e.g.,
http://localhost:3000/callback
).
-
Invite the Bot to Your Server:
- In the "OAuth2" tab, select the
bot
scope and choose the permissions your bot needs. - Copy the generated OAuth2 URL and paste it into your browser to invite the bot to your server.
- In the "OAuth2" tab, select the
-
Clone the repository:
git clone https://github.com/untanukii/serverguardbot.git
-
Navigate to the project directory:
cd serverguardbot
-
Install dependencies:
npm install
-
Configure environment variables:
A
.env.example
file is provided. Rename it to.env
and update with your configuration:DISCORD_TOKEN="secret discord bot token" CLIENT_ID="your client id" CLIENT_SECRET="your client secret"
-
Start the bot:
npm start
- Update
config.js
: Make sure to set the correct OAuth2 settings, including redirect URIs, scopes, and server addresses. - Redirect URI: Ensure the redirect URI specified in the OAuth2 settings matches the one configured in your Discord Developer Portal.
- Authorize the Bot: Use the OAuth2 URL to authorize the bot and ensure the user is a member of the required servers.
- Interact with the Bot: The bot will manage server access based on your configuration.
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Create a new Pull Request.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
If you find this project useful, please consider giving it a ⭐ on GitHub. Your support helps keep the project active and encourages further development.
For support or questions, please contact me on Discord @untanukii or Twitter.