From 3536fd8a661053d15d07c1e0d30ffc129566db08 Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Mon, 10 Oct 2022 11:43:30 +0200 Subject: [PATCH 1/3] Fix markdown for .env section Due to consecutive markdown blocks not being rendered correctly inside lists (only when accessing the page from the Pycord Guide), I removed one of the two examples that are basically showing the same thing in the same place. In addition to that, I improved the explanation so that it is more cleear for beginners. --- .../creating-your-first-bot.mdx | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/getting-started/creating-your-first-bot.mdx b/docs/getting-started/creating-your-first-bot.mdx index 2543de93..24d7ef46 100644 --- a/docs/getting-started/creating-your-first-bot.mdx +++ b/docs/getting-started/creating-your-first-bot.mdx @@ -90,28 +90,31 @@ getting leaked is to store it in `.env` files. You can store your tokens in `.env` files. This is a simple way to store sensitive information. -1. Create a file with the name `.env`. Just `.env`, with the dot/period at the start. -2. Define the token in the file, like so: - - - ```env title=".env" - TOKEN = [PASTE YOUR TOKEN HERE] - ``` - - for example: - - +1. Create a file with the name `.env` (only the extension, with a dot/period at the start and without a name before it). +2. Define the token in the `.env` file (replace the example value with your token). ```env title=".env" TOKEN = NzkyNzE1NDU0MTk2MDg4ODQy.X-hvzA.Ovy4MCQywSkoMRRclStW4xAYK7I ``` -3. Install [`python-dotenv`](https://pypi.org/project/python-dotenv/) +3. Install [`python-dotenv`](https://pypi.org/project/python-dotenv/). ```bash python -m pip install python-dotenv ``` +4. Load the token from the `.env` file. + ```python + dotenv.load_dotenv() + token = str(os.getenv("TOKEN")) +5. Pass your token as parameter when rurnning the bot. + ```python + client.run(token) + ``` + +:::tip If you are using Git to track your bot's changes, you should create a file called `.gitignore` and add `.env` to it. This stops your `.env` file from getting tracked along with the rest of your code, and -will not be pushed to a remote Git repository. It will stay secure on your local machine. +will not be pushed to a remote Git repository. As a consequence, it will stay secure on your local machine. + +::: ## Coding the Basics From bd76d1355214ddc270f46196ee16f85edb5daba2 Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Wed, 12 Oct 2022 00:26:44 +0200 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> --- docs/getting-started/creating-your-first-bot.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/creating-your-first-bot.mdx b/docs/getting-started/creating-your-first-bot.mdx index 24d7ef46..fe0f74b9 100644 --- a/docs/getting-started/creating-your-first-bot.mdx +++ b/docs/getting-started/creating-your-first-bot.mdx @@ -101,9 +101,10 @@ You can store your tokens in `.env` files. This is a simple way to store sensiti ``` 4. Load the token from the `.env` file. ```python + import dotenv dotenv.load_dotenv() token = str(os.getenv("TOKEN")) -5. Pass your token as parameter when rurnning the bot. +5. Pass your token as parameter when running the bot. ```python client.run(token) ``` From e94cea0bd276e91b0f545ce21ab44fcaa0d21ef1 Mon Sep 17 00:00:00 2001 From: Elitesparkle Date: Sun, 16 Oct 2022 10:31:45 +0200 Subject: [PATCH 3/3] Fix list items indent --- .../creating-your-first-bot.mdx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/getting-started/creating-your-first-bot.mdx b/docs/getting-started/creating-your-first-bot.mdx index a1f2b675..521758ff 100644 --- a/docs/getting-started/creating-your-first-bot.mdx +++ b/docs/getting-started/creating-your-first-bot.mdx @@ -99,16 +99,16 @@ You can store your tokens in `.env` files. This is a simple way to store sensiti ```bash python -m pip install python-dotenv ``` -4. Load the token from the `.env` file. - ```python - import dotenv - dotenv.load_dotenv() - token = str(os.getenv("TOKEN")) - ``` -5. Pass your token as parameter when running the bot. - ```python - client.run(token) - ``` +4. Load the token from the `.env` file. + ```python + import dotenv + dotenv.load_dotenv() + token = str(os.getenv("TOKEN")) + ``` +5. Pass your token as parameter when running the bot. + ```python + client.run(token) + ``` :::tip