aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2021-05-13 15:12:05 +0100
committerGravatar GitHub <[email protected]>2021-05-13 15:12:05 +0100
commit05ddf4355277edd2278cd5195fb6530b51f74f07 (patch)
treec52deb5a5db5d26703158612fca243ad39929532
parentMerge branch 'main' into extract-metabase-data (diff)
parentMerge pull request #1584 from Numerlor/docker-override (diff)
Merge branch 'main' into extract-metabase-data
-rw-r--r--.gitignore1
-rw-r--r--bot/exts/info/code_snippets.py2
-rw-r--r--bot/resources/tags/dotenv.md23
-rw-r--r--bot/resources/tags/ytdl.md2
4 files changed, 26 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 9186dbe06..f74a142f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -115,6 +115,7 @@ log.*
# Custom user configuration
config.yml
+docker-compose.override.yml
# xmlrunner unittest XML reports
TEST-**.xml
diff --git a/bot/exts/info/code_snippets.py b/bot/exts/info/code_snippets.py
index 06885410b..24a9ae28a 100644
--- a/bot/exts/info/code_snippets.py
+++ b/bot/exts/info/code_snippets.py
@@ -16,7 +16,7 @@ log = logging.getLogger(__name__)
GITHUB_RE = re.compile(
r'https://github\.com/(?P<repo>[a-zA-Z0-9-]+/[\w.-]+)/blob/'
- r'(?P<path>[^#>]+)(\?[^#>]+)?(#L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)'
+ r'(?P<path>[^#>]+)(\?[^#>]+)?(#L(?P<start_line>\d+)(([-~:]|(\.\.))L(?P<end_line>\d+))?)'
)
GITHUB_GIST_RE = re.compile(
diff --git a/bot/resources/tags/dotenv.md b/bot/resources/tags/dotenv.md
new file mode 100644
index 000000000..acb9a216e
--- /dev/null
+++ b/bot/resources/tags/dotenv.md
@@ -0,0 +1,23 @@
+**Using .env files in Python**
+
+`.env` (dotenv) files are a type of file commonly used for storing application secrets and variables, for example API tokens and URLs, although they may also be used for storing other configurable values. While they are commonly used for storing secrets, at a high level their purpose is to load environment variables into a program.
+
+Dotenv files are especially suited for storing secrets as they are a key-value store in a file, which can be easily loaded in most programming languages and ignored by version control systems like Git with a single entry in a `.gitignore` file.
+
+In python you can use dotenv files with the [`python-dotenv`](https://pypi.org/project/python-dotenv) module from PyPI, which can be installed with `pip install python-dotenv`. To use dotenv files you'll first need a file called `.env`, with content such as the following:
+```
+TOKEN=a00418c85bff087b49f23923efe40aa5
+```
+Next, in your main Python file, you need to load the environment variables from the dotenv file you just created:
+```py
+from dotenv import load_dotenv()
+
+load_dotenv(".env")
+```
+The variables from the file have now been loaded into your programs environment, and you can access them using `os.getenv()` anywhere in your program, like this:
+```py
+from os import getenv
+
+my_token = getenv("TOKEN")
+```
+For further reading about tokens and secrets, please read [this explanation](https://vcokltfre.dev/tips/tokens).
diff --git a/bot/resources/tags/ytdl.md b/bot/resources/tags/ytdl.md
index df28024a0..f96b7f853 100644
--- a/bot/resources/tags/ytdl.md
+++ b/bot/resources/tags/ytdl.md
@@ -1,4 +1,4 @@
-Per [PyDis' Rule 5](https://pythondiscord.com/pages/rules), we are unable to assist with questions related to youtube-dl, commonly used by Discord bots to stream audio, as its use violates YouTube's Terms of Service.
+Per [Python Discord's Rule 5](https://pythondiscord.com/pages/rules), we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in [YouTube's TOS](https://www.youtube.com/static?gl=GB&template=terms), as of 2021-03-17:
```