From 29aa72e12738fe3662d184627cc8a73ad6a24327 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Mon, 10 May 2021 15:27:10 +0200 Subject: Code snippet: support the two dots syntax Lines can be highlighted in GitHub using the `L00..L42` syntax, currently not supported by the regex. This commits adds it. --- bot/exts/info/code_snippets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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[a-zA-Z0-9-]+/[\w.-]+)/blob/' - r'(?P[^#>]+)(\?[^#>]+)?(#L(?P\d+)([-~:]L(?P\d+))?)' + r'(?P[^#>]+)(\?[^#>]+)?(#L(?P\d+)(([-~:]|(\.\.))L(?P\d+))?)' ) GITHUB_GIST_RE = re.compile( -- cgit v1.2.3 From 0af0e0213250b66cc37cb10ecb91a8b35978e4a1 Mon Sep 17 00:00:00 2001 From: vcokltfre Date: Mon, 10 May 2021 15:49:11 +0100 Subject: feat: add dotenv tag --- bot/resources/tags/dotenv.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 bot/resources/tags/dotenv.md diff --git a/bot/resources/tags/dotenv.md b/bot/resources/tags/dotenv.md new file mode 100644 index 000000000..cbf23c07c --- /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` 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). -- cgit v1.2.3 From 772fa4b39e50a57b10a5d8ab35ffd42a9efdaa44 Mon Sep 17 00:00:00 2001 From: vcokltfre Date: Mon, 10 May 2021 15:54:32 +0100 Subject: chore: add pypi link for python-dotenv --- bot/resources/tags/dotenv.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/resources/tags/dotenv.md b/bot/resources/tags/dotenv.md index cbf23c07c..acb9a216e 100644 --- a/bot/resources/tags/dotenv.md +++ b/bot/resources/tags/dotenv.md @@ -4,7 +4,7 @@ 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` 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: +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 ``` -- cgit v1.2.3 From b9bf4fdc0e0adb4af4bda3316afa3a0d8c4a476f Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Wed, 12 May 2021 02:15:11 +0300 Subject: Updates YTDL Tag (#1583) * Updates YTDL Tag Updates the tag to include similar tools, and adds an open-ended descriptor. Co-authored-by: ChrisJL --- bot/resources/tags/ytdl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: ``` -- cgit v1.2.3 From cee1d393534ccf38ac8c369dc8d20976a951a4fe Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Wed, 12 May 2021 15:27:56 +0200 Subject: Add docker-compose.override.yml to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3