diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md index 5dc6408cd..e4b7ec27d 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md @@ -94,11 +94,7 @@ GitHub is a website based on Git that stores project files in the cloud. We use *Note: Members of the Python Discord staff can create feature branches directly on the repo without forking it.* -Check out our [**guide on forking a GitHub repo**](./forking-repository/). - -Now that you have your own fork you need to be able to make changes to the code. You can clone the repo to your local machine, commit changes to it there, then push those changes to GitHub. - -Check out our [**guide on cloning a GitHub repo**](./cloning-repository/). +Check out our [**guide on forking and cloning a GitHub repository**](./forking-and-cloning/). ### 2. Set up the project You have the source code on your local computer, now how do you actually run it? We have detailed guides on setting up the environment for each of our main projects: diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md index 25bea2736..ba44f2c89 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md @@ -4,131 +4,95 @@ description: A guide to setting up and configuring Bot. icon: fab fa-github toc: 3 --- -The purpose of this guide is to get you a running local version of [the Python bot](https://github.com/python-discord/bot). -You should have already forked the repository and cloned it to your local machine. If not, check out our [detailed walkthrough](../#1-fork-and-clone-the-repo). - -This page will focus on the quickest steps one can take, with mentions of alternatives afterwards. +This guide will walk you through setting up and running [the Python bot](https://github.com/python-discord/bot) locally, +and get you ready to contribute to it. --- ## Setting up the project -### Setup Project Dependencies -Below are the dependencies you **must** have installed to get started with the bot. - -1. Make sure you have [Python 3.14](https://www.python.org/downloads/) installed. uv [can also be used to](https://docs.astral.sh/uv/guides/install-python/#installing-python) install Python, if desired. -2. [Install uv](https://github.com/astral-sh/uv#installation). -3. [Install the project's dependencies](../installing-project-dependencies). -4. Docker. - -
- - -
-
+### Install Project Requirements +The following are needed to run the bot. Follow the links for installation instructions. + +- [uv](https://docs.astral.sh/uv/getting-started/installation/). +- [Python 3.14](https://www.python.org/downloads/). This can be installed [using uv](https://docs.astral.sh/uv/guides/install-python/#installing-python). +- [Docker](https://docs.docker.com/get-started/get-docker/). + +### Set Up a Development Environment + +To start, ensure you have forked and cloned the [bot repository](https://github.com/python-discord/bot) to your local machine. For help with this, check out our [forking and cloning guide](../forking-and-cloning). + +From the root of the cloned repository, run the following command to install the project dependencies: + +```shell +$ uv sync +``` + +You should also install our pre-commit hooks, which will lint your code before you commit it. +```shell +$ uv run task precommit +``` ### Set Up a Test Server -The Python bot is tightly coupled with the Python Discord server, so to have a functional version of the bot you need a server with channels it can use. -It's possible to set the bot to use a single channel for all cogs, but that will cause extreme spam and will be difficult to work with. +The Python bot is tightly coupled with the Python Discord server, so the bot expects the existence of certain +channels, roles, and other server configurations to be able to run. -You can start your own server and set up channels as you see fit, but for your convenience we have a template for a development server you can use: [https://discord.new/zmHtscpYN9E3](https://discord.new/zmHtscpYN9E3). +It is highly recommended to use our [server template](https://discord.new/zmHtscpYN9E3), +as it allows most configuration to be automatically generated for you. -Keep in mind that this is not an exact mirror of the Python server, but a reduced version for testing purposes. -The channels there are mostly the ones needed by the bot. ---- +This is not an exact mirror of the Python server, but a reduced version for testing purposes. ### Set Up a Bot Account You will need your own bot account on Discord to test your changes to the bot. -See [here](../creating-bot-account) for help with setting up a bot account. Once you have a bot account, invite it to the test server you created in the previous section. +See [our guide](../creating-bot-account) for help with setting up a bot account, and inviting it to your server. -#### Privileged Intents +If you want to use an existing test bot account, ensure that: -It is necessary to explicitly request that your Discord bot receives certain gateway events. -The Python bot requires `Server Member Intent` and `Message Content Intent` to function. -In order to enable it, visit the [Developer Portal](https://discord.com/developers/applications/) (from where you copied your bot's login token) and scroll down to the `Privileged Gateway Intents` section. -The `Presence Intent` is not necessary and can be left disabled. - -If your bot fails to start with a `PrivilegedIntentsRequired` exception, this indicates that the required intents were not enabled. - ---- +- It has the `Server Members Intent` and `Message Content Intent` intents enabled. +- It was invited to your server with the `bot` scope and `Administrator` permission. ### Configure the Bot -You now have both the bot's code and a server to run it on. It's time for you to connect the two by setting the bot's configuration. -Both `.env` and `.env.server` files we talk about below are ignored by git, so they do not get accidentally commit to the repository. +The bot reads variables for configuration from two files, `.env`, and `.env.server`. These files are ignored by git, as they contain information specific to your local environment. #### .env -This file will contain sensitive information such as your bot's token, do not share it with anybody! -To start, create a `.env` file in the project root with the below content. +Create a file called `.env` in the project root with the below content, and insert your bot token and guild ID. Remember that your bot token is sensitive information, and should not be shared with anyone. ```text BOT_TOKEN=YourDiscordBotTokenHere GUILD_ID=YourDiscordTestServerIdHere -BOT_PREFIX=YourDesiredPrefixHere ``` See [here](../creating-bot-account) for help with obtaining the bot token, and [here](../obtaining-discord-ids#guild-id) for help with obtaining the guild's ID. -Other values will be added to your `.env` over time as you need to interact with other parts of the bot, but those are not needed for a basic setup. For a full list of support values see the ENV file option [appendix](#appendix-full-env-file-options) +This is all that is needed for a basic setup. See the [appendix](#appendix-full-env-file-options) for a full list of available variables. #### .env.server -All server related configuration values are saved in this file, which also needs to be at the root directory of the project. -We provide a script to automatically generate a server config. -**Note**: The script **only** works with servers created with the template mentioned above. +This file is automatically generated by our bootstrap script, which connects +to your server and extracts configuration needed for the bot to run. -If you want to setup the bot from an existing guild read out [manual configuration guide](../bot-extended-configuration-options#manual-constants-configuration). This is far more complicated and time consuming. - -Running the below command will use the `BOT_TOKEN` and `GUILD_ID` from the `.env` file you created above to download all of the relevant IDs from the template guild into your `.env.server` - -**Note**: This script will overwrite the `.env.server` file. We suggest you put any configuration not generated by this script in to `.env` instead +To run the script, execute the following command in the project root: ```shell $ uv run task configure ``` -Once the script has finished running, you'll notice the creation of a new file called `.env.server` at your project's root directory. -This file will contain the extracted IDs from your server which are necessary for your bot to run. +**Note**: The script only works with servers created with the template mentioned above. To configure the bot manually, see our [manual configuration guide](../bot-extended-configuration-options#manual-constants-configuration). +{: .notification } -**Congratulations**, you have finished the configuration and can now [run your bot](#run-it). +**Note**: This script will overwrite the `.env.server` file. We suggest you put any configuration not generated by this script in to `.env` instead. +{: .notification } -
- - -
-
+Ensure that this runs successfully, and that the `.env.server` file is created in the project root. +--- -### Run it! -#### With Docker -You are now almost ready to run the Python bot. The simplest way to do so is with Docker. +**Congratulations**, you have finished the configuration and can now [run your bot](#run-it). +### Run it! +You are now ready to run the bot. The simplest way to do so is with Docker. -With all of the above setup, you can run the project with `docker compose up`. This will start the bot and all required services! Enter your server and type `!help` (or whatever prefix you chose instead of `!`) to see the bot in action! +Start the project by running the command `docker compose up`. This will start the bot and all required services! Enter your server and type `!help` to see the bot in action! Some other useful docker commands are as follows: @@ -139,6 +103,8 @@ Your bot is now running, all inside Docker. **Note**: If you want to read about how to make debugging with an IDE a easier, or for additional running methods, check out our [extended configuration guide](../bot-extended-configuration-options). +If you encounter issues with docker, check out our [docker guide](../docker), which lists some common issues and their solutions. + --- ## Development Tips diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md deleted file mode 100644 index 23d525b85..000000000 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Cloning a Repository -description: A guide to cloning git repositories. -icon: fab fa-github ---- - -> **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: - -- [Cloning with the command line](#cloning-with-the-command-line) -- [Cloning with PyCharm](#cloning-with-pycharm) - -The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. You should have already retrieved your fork's Git URL as described in [**Creating a Fork**](../forking-repository). - ---- - -## Cloning with the command line - -1. Clone your forked repository using `git clone` followed by your fork's Git URL. Then, change your working directory to the repository. - -```shell -$ git clone https://github.com//sir-lancebot -... -$ cd sir-lancebot -``` - ---- - -## Cloning with PyCharm - -1. Load up PyCharm and click `Get from VCS`.
- ![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png) -2. Enter the URL of your forked repository. -3. Change the directory if you desire and click `Clone`.
- ![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/creating-bot-account.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/creating-bot-account.md index 51da3f34d..31fe26c69 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/creating-bot-account.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/creating-bot-account.md @@ -3,15 +3,19 @@ title: Setting up a Bot Account description: How to set up a bot account. icon: fab fa-discord --- -1. Go to the [Discord Developers Portal](https://discordapp.com/developers/applications/). -2. Click on the `New Application` button, enter your desired bot name, and click `Create`. -3. In your new application, go to the `Bot` tab, click `Add Bot`, and confirm `Yes, do it!` -4. Change your bot's `Public Bot` setting off so only you can invite it, save, and then get your **Bot Token** with the `Copy` button. -> **Note:** **DO NOT** post your bot token anywhere public. If you do it can and will be compromised. -5. Save your **Bot Token** somewhere safe to use in the project settings later. -6. In the `General Information` tab, grab the **Application ID**. -7. Replace `` in the following URL and visit it in the browser to invite your bot to your new test server. -```plaintext -https://discordapp.com/api/oauth2/authorize?client_id=&permissions=8&scope=bot -``` -Optionally, you can generate your own invite url in the `OAuth` tab, after selecting `bot` as the scope. +1. Go to the [Discord Developers Portal](https://discord.com/developers/applications). +1. Click on the `New Application` button, enter your desired bot name, and click `Create`. +1. In the `Installation` tab, set `Install Link` to `None` and click `Save Changes`. +1. In the `Bot` tab: + + - Turn off the `Public Bot` setting. + - Turn on the `Message Content Intent` setting. + - If setting up Python Bot, also turn on the `Server Members Intent` setting. + - ...and click `Save Changes`. + +1. Click the `Reset Token` button and then `Copy` the generated token. Save it somewhere safe, as you will need it later. + + **Note**: Do not post this token anywhere public, as it grants complete control of your bot. + {: .notification .is-warning } + +1. In the `OAuth2` tab, select the `bot` scope and `Administrator` permission, and visit the generated URL in your Discord app or browser to invite the bot to your server. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/docker.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/docker.md index 63be9f3e4..a69a230c2 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/docker.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/docker.md @@ -5,7 +5,7 @@ icon: fab fa-docker toc: 2 --- -Both our [Site](../site/) and [Bot](../bot/) projects use Docker and Docker-Compose during development in order to provide an easy to setup and consistent development environment. +Both our [Site](../site/) and [Bot](../bot/) projects use Docker and Docker Compose during development in order to provide an easy to setup and consistent development environment. Consider reading some of the following topics if you're interested in learning more about Docker itself: @@ -15,12 +15,12 @@ Consider reading some of the following topics if you're interested in learning m # Docker Installation You can find installation guides available for your respective OS from the official Docker documentation: -[https://docs.docker.com/install/](https://docs.docker.com/install/) +[https://docs.docker.com/get-started/get-docker/](https://docs.docker.com/get-started/get-docker/) ## After Installing on Linux If you're on Linux, there's a few extra things you should do: -1. [**Add your user to the `docker` user group so you don't have to use `sudo` when running docker or docker-compose.**](#add-user-group) +1. [**Add your user to the `docker` user group so you don't have to use `sudo` when running docker**](#add-user-group) 2. [**Start up the Docker service.**](#run-the-service) 3. [**Set the Docker service to start on boot.**](#start-on-boot) **(optional)** @@ -67,7 +67,7 @@ Remove the existing `~/.docker/` directory. It will be automatically re-created ### Drive has not been shared (Windows users) -When attempting to run the `docker-compose up` command on a Windows machine, you receive the following or similar error message: +When attempting to run the `docker compose up` command on a Windows machine, you receive the following or similar error message: ```text ERROR: for bot_bot_1 Cannot create container for service bot: b'Drive has not been shared' ``` @@ -85,11 +85,27 @@ Windows has not been configured to share drives with Docker. 3. Click "Apply" and enter appropriate Windows credentials (likely just your own account, if you have administrative privileges). -4. Re-run the `docker-compose up` command. +4. Re-run the `docker compose up` command. + +### Issues running on Apple Silicon + +Attempting to run some images on non-amd64 architectures may show an error like this: + +``` +no matching manifest for linux/arm64/v8 in the manifest list entries +``` + +This is due to some images that we use only being build for amd64. + +You can force the use of amd64 by setting the following environment variable before running docker commands: + +``` +DOCKER_DEFAULT_PLATFORM=linux/amd64 +``` # Compose Project Names -When you launch services from a docker-compose, you'll notice the name of the containers aren't just the service name. -You'll see this when launching your compose, as well as being able to be seen in the command `docker-compose ps` which will list the containers. +When you launch services using Docker Compose, you'll notice the name of the containers aren't just the service name. +You'll see this when launching your compose, as well as being able to be seen in the command `docker compose ps` which will list the containers. It should match something like this: ``` site_site_1 diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/forking-and-cloning.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/forking-and-cloning.md new file mode 100644 index 000000000..6f83a0864 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/forking-and-cloning.md @@ -0,0 +1,55 @@ +--- +title: Forking and Cloning a Repository +description: A guide to forking and cloning repositories on GitHub. +icon: fab fa-github +--- + +We develop our projects on GitHub, which is a platform for hosting and collaborating on code. +In order to run our projects yourself, you will need a local copy of the relevant repository on your computer. + +As you do not have write access directly to our repositories, you will first need to create a fork of the repository, +which is your own repository on GitHub. This will allow you to push changes to a branch on your fork, and create a +pull request to propose your changes to the main repository. + +After you have created a fork, you will then need to clone the repository to your computer, which is the process +of downloading the repository from GitHub to your local machine. You will need Git installed on your computer to do this. + +The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. + +See our [working with Git guide](./working-with-git) for more information on how to work with Git. + +# Forking a Repository + +*Note: Members of the Python Discord staff can create feature branches directly on the repository without forking it.* + +1. Navigate to the repository page on GitHub and press the `Fork` button at the top of the page. +![Github Fork Button](/static/images/content/contributing/fork_button.png) +2. Fork it to your account.
+![Github Fork to User](/static/images/content/contributing/fork_user.png) +3. Later, you will need the Git URL of your forked repository in order to clone it. +In your newly forked repository, copy the Git URL by clicking the green `Code` button, then click the Copy Link button. +![Github Fork Clone URL](/static/images/content/contributing/fork_clone.png) + +> If you have SSH set up with GitHub, you may instead click the `SSH` button above the Copy Link button to get the SSH URL. + +# Cloning a Repository + +You can clone a repository using the command line directly, or by using your IDEs built-in Git integration. We will cover how to do this with the command line, and with PyCharm's integration. + +## Cloning with the command line + +1. Clone your forked repository using `git clone` followed by your fork's Git URL. Then, change your working directory to the repository. + +```shell +$ git clone https://github.com//sir-lancebot +... +$ cd sir-lancebot +``` + +## Cloning with PyCharm + +1. Load up PyCharm and click `Get from VCS`.
+ ![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png) +2. Enter the URL of your forked repository. +3. Change the directory if you desire and click `Clone`.
+ ![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/forking-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/forking-repository.md deleted file mode 100644 index 07535dbe7..000000000 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/forking-repository.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Forking a Repository -description: A guide to forking git repositories. -icon: fab fa-github ---- - -Before contributing to any project, you will have to fork the project, ie. create your own online copy of the project. -The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. - -1. Navigate to the repository page and press the `Fork` button at the top of the page. -![Github Fork Button](/static/images/content/contributing/fork_button.png) -2. Fork it to your account.
-![Github Fork to User](/static/images/content/contributing/fork_user.png) -3. Later, you will need the Git URL of your forked repository in order to clone it. -In your newly forked repository, copy the Git URL by clicking the green `Code` button, then click the Copy Link button. -![Github Fork Clone URL](/static/images/content/contributing/fork_clone.png) - -> If you have SSH set up with GitHub, you may instead click the `SSH` button above the Copy Link button to get the SSH URL. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md deleted file mode 100644 index 202e22134..000000000 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: Installing Project Dependencies -description: A guide to installing the dependencies of our projects. -icon: fab fa-python ---- - -> **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: - -- [Installing dependencies with the command line](#installing-dependencies-with-the-command-line) -- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm) - -The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. -You should have already cloned your fork as described in [**Cloning a Repository**](../cloning-repository). - ---- - -## Installing dependencies with the command line - -1. Make sure you are in the root project directory. This directory will always have a file titled `README.md`. -2. Install project and development dependencies. Remember to also set up pre-commit hooks to ensure your pushed commits will never fail linting. - ---- - -```shell -$ uv sync -$ uv run task precommit -``` - ---- diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/obtaining-discord-ids.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/obtaining-discord-ids.md index afa07b5a2..db50524dd 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/obtaining-discord-ids.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/obtaining-discord-ids.md @@ -5,8 +5,9 @@ icon: fab fa-discord --- First, enable developer mode in your client so you can easily copy IDs. -1. Go to your `User Settings` and click on the `Appearance` tab. -2. Under `Advanced`, enable `Developer Mode`. +1. Open your `User Settings` by clicking the gear icon in the bottom left of the Discord client. +1. Scroll down to the `Developer` section at the bottom of the left sidebar. +1. Enable the `Developer Mode` option. #### Guild ID diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/setting-test-server-and-bot-account.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/setting-test-server-and-bot-account.md deleted file mode 100644 index e95555755..000000000 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/setting-test-server-and-bot-account.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Setting Up a Test Server and Bot Account -description: How to get started with testing our bots. -icon: fab fa-discord ---- - -## Setting up a Test Server - -1. Create a Discord Server if you haven't got one already to use for testing. - ---- - -## Setting up a Bot Account - -1. Go to the [Discord Developers Portal](https://discordapp.com/developers/applications/). -2. Click on the `New Application` button, enter your desired bot name, and click `Create`. -3. In your new application, go to the `Bot` tab, click `Add Bot`, and confirm `Yes, do it!` -4. Change your bot's `Public Bot` setting off so only you can invite it, save, and then get your **Bot Token** with the `Copy` button. -> **Note:** **DO NOT** post your bot token anywhere public, or it can and will be compromised. -5. Save your **Bot Token** somewhere safe to use in the project settings later. -6. Scroll down to the `Privileged Gateway Intents` section and enable required intents. -> For Sir Lancebot, you need to enable `Server Member Intent`. For Python Bot, you need to enable `Server Member Intent` and `Message Content Intent`. -> Failure to do so will result in a `PrivilegedIntentsRequired` exception when you start the bot. -7. In the `OAuth2` tab, grab the **Client ID**. -8. Replace `` in the following URL and visit it in the browser to invite your bot to your new test server. -```plaintext -https://discordapp.com/api/oauth2/authorize?client_id=&permissions=8&scope=bot -``` ---- - -## Obtain the IDs - -First, enable developer mode in your client so you can easily copy IDs. - -1. Go to your `User Settings` and click on the `Appearance` tab. -2. Under `Advanced`, enable `Developer Mode`. - -#### Guild ID - -Right click the server icon and click `Copy ID`. - -#### Channel ID - -Right click a channel name and click `Copy ID`. - -#### Role ID - -Right click a role and click `Copy ID`. -The easiest way to do this is by going to the role list in the guild's settings. - -#### Emoji ID - -Insert the emoji into the Discord text box, then add a backslash `\` right before the emoji and send the message. -The result should be similar to the following - -```plaintext -<:bbmessage:511950877733552138> -``` - -The long number you see, in this case `511950877733552138`, is the emoji's ID. - -#### Webhook ID - -Once a [webhook](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks) is created, the ID is found in the penultimate part of the URL. -For example, in the following URL, `661995360146817053` is the ID of the webhook. - -```plaintext -https://discordapp.com/api/webhooks/661995360146817053/t-9mI2VehOGcPuPS_F8R-6mB258Ob6K7ifhtoxerCvWyM9VEQug-anUr4hCHzdbhzfbz -``` diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md index c618a4cbe..b805a4509 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md @@ -19,20 +19,6 @@ Remember to ensure that you have read the [contributing guidelines](../contribut --- -## Using Gitpod -Sir Lancebot can be edited and tested on Gitpod. Gitpod will automatically install the correct dependencies and Python version, so you can get straight to coding. - -To do this, you will need a Gitpod account, which you can get [here](https://www.gitpod.io/#get-started), and a fork of Sir Lancebot. This guide covers forking the repository [here](../forking-repository). - -Afterwards, click on [this link](https://gitpod.io/#/github.com/python-discord/sir-lancebot) to spin up a new workspace for Sir Lancebot. Then run the following commands in the terminal after the existing tasks have finished running: -```sh -git remote rename origin upstream -git remote add origin https://github.com/{your_username}/sir-lancebot -``` -Make sure you replace `{your_username}` with your Github username. These commands will set the Sir Lancebot repository as the secondary remote, and your fork as the primary remote. This means you can easily grab new changes from the main Sir Lancebot repository. - -Once you've set up [a test server and bot account](#test-server-and-bot-account) and your [environment variables](#environment-variables), you are ready to begin contributing to Sir Lancebot! - ## Using Docker Sir Lancebot can be started using Docker. Using Docker is generally recommended (but not strictly required) because it abstracts away some additional set up work. @@ -45,15 +31,24 @@ The requirements for Docker are: --- # Development Environment -If you aren't using Docker, you will need to [install the project's dependencies](../installing-project-dependencies) yourself. +From the root of the cloned repository, run the following command to install the project dependencies: + +```shell +$ uv sync +``` + +You should also configure precommit hooks, which will lint your code before you commit it. +```shell +$ uv run task precommit +``` --- # Test Server and Bot Account You will need your own test server and bot account on Discord to test your changes to the bot. -1. [**Create a test server**](../setting-test-server-and-bot-account#setting-up-a-test-server). -2. [**Create a bot account**](../setting-test-server-and-bot-account#setting-up-a-bot-account) and invite it to the server you just created. +1. Create a test server. +2. [**Create a bot account**](../creating-bot-account) and invite it to the server you just created. 3. Create the following text channels: * `#announcements` * `#dev-log` @@ -62,7 +57,7 @@ You will need your own test server and bot account on Discord to test your chang * `@Admins` * `@Helpers` 5. Note down the IDs for your server, as well as any channels and roles created. - * [**Learn how to obtain the ID of a server, channel or role here.**](../setting-test-server-and-bot-account#obtain-the-ids) + * [**Learn how to obtain the ID of a server, channel or role here.**](../obtaining-discord-ids) --- diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index ab6ddc162..da4e52151 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -18,9 +18,8 @@ You should have already forked the [`site`](https://github.com/python-discord/si Using Docker (recommended): -- [Docker CE](https://docs.docker.com/install/) -- [Docker Compose](https://docs.docker.com/compose/install/) - - `pip install docker-compose` +- [Docker](https://docs.docker.com/get-started/get-docker/) + Without Docker: @@ -30,7 +29,16 @@ Without Docker: --- # Development environment -[Install the project's dependencies](../installing-project-dependencies/) +From the root of the cloned repository, run the following command to install the project dependencies: + +```shell +$ uv sync +``` + +You should also configure precommit hooks, which will lint your code before you commit it. +```shell +$ uv run task precommit +``` ## Without Docker @@ -86,7 +94,7 @@ The project can be started with Docker or by running it directly on your system. Start the containers using Docker Compose: ```shell -docker-compose up +docker compose up ``` The `-d` option can be appended to the command to run in detached mode. This runs the containers in the background so the current terminal session is available for use with other things. @@ -106,7 +114,7 @@ Note that this can still be done with Docker even if the webserver will be runni If you chose to use Docker for just the database, use Docker Compose to start the container: ```shell -docker-compose up postgres +docker compose up postgres ``` If you're not using Docker, then use [pg_ctl](https://www.postgresql.org/docs/current/app-pg-ctl.html) or your system's service manager if PostgreSQL isn't already running. diff --git a/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md b/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md index 7af6a0bb9..3ed7c3920 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md +++ b/pydis_site/apps/content/resources/guides/python-guides/docker-hosting-guide.md @@ -164,7 +164,7 @@ docker compose up -d --build Now the docker will automatically build the image for you and run the container. -### Why docker-compose +### Why Docker Compose The main purpose of Compose is to run several services at once. Mostly we don't need this in discord bots, however.