From de738c361fe849710aae5bab0050dc45b0a85ac4 Mon Sep 17 00:00:00 2001 From: Florian Beisel Date: Mon, 15 Jan 2024 19:31:10 +0100 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Add=20usage=20instructio?= =?UTF-8?q?ns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What our documentation was still missing were details about how to get the bot to join a Discord server (ie how to generate a Discord Token) and what was needed on the Gitea side. Also we previously ommited how to interact with the bot once it was joined to a server. What we're still missing, are details on the Discord Token Scopes that are required. fixes #6 --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index 47f6601..229a8b7 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,36 @@ The bot requires the following environment variables to be set: - `GITEA_TOKEN`: The API token for accessing Gitea. - `GITEA_URL`: The base URL of your Gitea instance. +### How to get the `DISCORD_TOKEN` + +1. Log in to the Discord Developer Portal + +2. **Create a New Application:** + Click on the "New Application" button. Name your application and create it. + +3. **Create a Bot User:** + In your application's settings, navigate to the "Bot" tab. + Click on the "Add Bot" button and confirm the creation. This will create a new bot user associated with your application. + +4. **Get the Bot Token:** + Under the bot settings, you will find a section labeled "TOKEN" with a link to "Copy". + Click on "Copy" to copy the bot token. You'll use this token in your bot's configuration. + +5. **Invite the Bot to Your Server:** + In the application settings, navigate to the "OAuth2" tab. + Under "SCOPES", check bot. + In the "BOT PERMISSIONS" section, select the permissions your bot requires. + Copy the generated URL under "SCOPES" and paste it into your web browser. This will allow you to add the bot to one of your Discord servers. + +### How to get the Gitea Token + +1. Login to your gitea instance with a user that has access to the Administration or create a user with "Administrator" privileges. + +2. Navigate to your user settings and select "Applications" in the sidebar (`https://GITEA_URL/user/settings/applications`). + Now you will need create an Access Token with write privileges to the `admin` scope. + +3. Record the Token that is displayed when saving the token. + ## Build it yourself To build the bot from source, follow these steps: @@ -96,6 +126,16 @@ To run the binary: For Windows, simply execute the .exe file after setting your environment variables. +## Creating Gitea users from Discord + +Once you have the bot up and running with the required environment variables set and invited it to your Discord server you can start creating users. The bot will listen to the `!register` command and expects the following syntax: + +```bash +!register --username=[Desired Username] --email=[Your Email address] +``` + +The bot will open a conversation via DM with the user who issued the command and confirm whether the registration was successful with the URL of the Gitea Server, and a temporary password which has to be changed on first login. + ## Contributing Contributions to this project are welcome. Please ensure you follow the existing code style.