Merge remote-tracking branch 'release/V3/develop' into V3/develop

This commit is contained in:
palmtree5 2020-02-15 11:27:21 -09:00
commit 2c996307f5
1173 changed files with 164246 additions and 52283 deletions

396
.bandit.yml Normal file
View File

@ -0,0 +1,396 @@
### Bandit config file generated
### This config may optionally select a subset of tests to run or skip by
### filling out the 'tests' and 'skips' lists given below. If no tests are
### specified for inclusion then it is assumed all tests are desired. The skips
### set will remove specific tests from the include set. This can be controlled
### using the -t/-s CLI options. Note that the same test ID should not appear
### in both 'tests' and 'skips', this would be nonsensical and is detected by
### Bandit at runtime.
# Available tests:
# B101 : assert_used
# B102 : exec_used
# B103 : set_bad_file_permissions
# B104 : hardcoded_bind_all_interfaces
# B105 : hardcoded_password_string
# B106 : hardcoded_password_funcarg
# B107 : hardcoded_password_default
# B108 : hardcoded_tmp_directory
# B110 : try_except_pass
# B112 : try_except_continue
# B201 : flask_debug_true
# B301 : pickle
# B302 : marshal
# B303 : md5
# B304 : ciphers
# B305 : cipher_modes
# B306 : mktemp_q
# B307 : eval
# B308 : mark_safe
# B309 : httpsconnection
# B310 : urllib_urlopen
# B311 : random
# B312 : telnetlib
# B313 : xml_bad_cElementTree
# B314 : xml_bad_ElementTree
# B315 : xml_bad_expatreader
# B316 : xml_bad_expatbuilder
# B317 : xml_bad_sax
# B318 : xml_bad_minidom
# B319 : xml_bad_pulldom
# B320 : xml_bad_etree
# B321 : ftplib
# B322 : input
# B323 : unverified_context
# B324 : hashlib_new_insecure_functions
# B325 : tempnam
# B401 : import_telnetlib
# B402 : import_ftplib
# B403 : import_pickle
# B404 : import_subprocess
# B405 : import_xml_etree
# B406 : import_xml_sax
# B407 : import_xml_expat
# B408 : import_xml_minidom
# B409 : import_xml_pulldom
# B410 : import_lxml
# B411 : import_xmlrpclib
# B412 : import_httpoxy
# B413 : import_pycrypto
# B501 : request_with_no_cert_validation
# B502 : ssl_with_bad_version
# B503 : ssl_with_bad_defaults
# B504 : ssl_with_no_version
# B505 : weak_cryptographic_key
# B506 : yaml_load
# B507 : ssh_no_host_key_verification
# B601 : paramiko_calls
# B602 : subprocess_popen_with_shell_equals_true
# B603 : subprocess_without_shell_equals_true
# B604 : any_other_function_with_shell_equals_true
# B605 : start_process_with_a_shell
# B606 : start_process_with_no_shell
# B607 : start_process_with_partial_path
# B608 : hardcoded_sql_expressions
# B609 : linux_commands_wildcard_injection
# B610 : django_extra_used
# B611 : django_rawsql_used
# B701 : jinja2_autoescape_false
# B702 : use_of_mako_templates
# B703 : django_mark_safe
# (optional) list included test IDs here, eg '[B101, B406]':
tests:
# (optional) list skipped test IDs here, eg '[B101, B406]':
skips: ['B322']
### (optional) plugin settings - some test plugins require configuration data
### that may be given here, per-plugin. All bandit test plugins have a built in
### set of sensible defaults and these will be used if no configuration is
### provided. It is not necessary to provide settings for every (or any) plugin
### if the defaults are acceptable.
any_other_function_with_shell_equals_true:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
hardcoded_tmp_directory:
tmp_dirs:
- /tmp
- /var/tmp
- /dev/shm
linux_commands_wildcard_injection:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
ssl_with_bad_defaults:
bad_protocol_versions:
- PROTOCOL_SSLv2
- SSLv2_METHOD
- SSLv23_METHOD
- PROTOCOL_SSLv3
- PROTOCOL_TLSv1
- SSLv3_METHOD
- TLSv1_METHOD
ssl_with_bad_version:
bad_protocol_versions:
- PROTOCOL_SSLv2
- SSLv2_METHOD
- SSLv23_METHOD
- PROTOCOL_SSLv3
- PROTOCOL_TLSv1
- SSLv3_METHOD
- TLSv1_METHOD
start_process_with_a_shell:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
start_process_with_no_shell:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
start_process_with_partial_path:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
subprocess_popen_with_shell_equals_true:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
subprocess_without_shell_equals_true:
no_shell:
- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
shell:
- os.system
- os.popen
- os.popen2
- os.popen3
- os.popen4
- popen2.popen2
- popen2.popen3
- popen2.popen4
- popen2.Popen3
- popen2.Popen4
- commands.getoutput
- commands.getstatusoutput
subprocess:
- subprocess.Popen
- subprocess.call
- subprocess.check_call
- subprocess.check_output
- subprocess.run
try_except_continue:
check_typed_exception: false
try_except_pass:
check_typed_exception: false
weak_cryptographic_key:
weak_key_size_dsa_high: 1024
weak_key_size_dsa_medium: 2048
weak_key_size_ec_high: 160
weak_key_size_ec_medium: 224
weak_key_size_rsa_high: 1024
weak_key_size_rsa_medium: 2048

View File

@ -2,14 +2,15 @@ version: "2" # required to adjust maintainability checks
checks: checks:
argument-count: argument-count:
config: config:
threshold: 6 threshold: 8 # work on this later
complex-logic: complex-logic:
enabled: false # Disabled in favor of using Radon for this enabled: false # Disabled in favor of using Radon for this
config: config:
threshold: 4 threshold: 4
file-lines: file-lines:
enabled: false # enable after audio stuff...
config: config:
threshold: 1000 # I would set this lower if not for cogs as command containers. threshold: 2000 # I would set this lower if not for cogs as command containers.
method-complexity: method-complexity:
enabled: false # Disabled in favor of using Radon for this enabled: false # Disabled in favor of using Radon for this
config: config:
@ -24,7 +25,7 @@ checks:
threshold: 25 # I'm fine with long methods, cautious about the complexity of a single method. threshold: 25 # I'm fine with long methods, cautious about the complexity of a single method.
nested-control-flow: nested-control-flow:
config: config:
threshold: 4 threshold: 6
return-statements: return-statements:
config: config:
threshold: 6 threshold: 6
@ -33,12 +34,19 @@ checks:
config: config:
threshold: # language-specific defaults. an override will affect all languages. threshold: # language-specific defaults. an override will affect all languages.
identical-code: identical-code:
enabled: false
config: config:
threshold: # language-specific defaults. an override will affect all languages. threshold: # language-specific defaults. an override will affect all languages.
plugins: plugins:
bandit: bandit:
enabled: true enabled: false
radon: radon:
enabled: true enabled: false
config: config:
threshold: "D" threshold: "D"
duplication:
enabled: false
config:
languages:
python:
python_version: 3

6
.github/CODEOWNERS vendored
View File

@ -25,11 +25,12 @@ redbot/core/utils/antispam.py @mikeshardmind
redbot/core/utils/tunnel.py @mikeshardmind redbot/core/utils/tunnel.py @mikeshardmind
redbot/core/utils/caching.py @mikeshardmind redbot/core/utils/caching.py @mikeshardmind
redbot/core/utils/common_filters.py @mikeshardmind redbot/core/utils/common_filters.py @mikeshardmind
redbot/core/utils/dbtools.py @mikeshardmind
# Cogs # Cogs
redbot/cogs/admin/* @tekulvw redbot/cogs/admin/* @tekulvw
redbot/cogs/alias/* @tekulvw redbot/cogs/alias/* @tekulvw
redbot/cogs/audio/* @aikaterna redbot/cogs/audio/* @aikaterna @Drapersniper
redbot/cogs/bank/* @tekulvw redbot/cogs/bank/* @tekulvw
redbot/cogs/cleanup/* @palmtree5 redbot/cogs/cleanup/* @palmtree5
redbot/cogs/customcom/* @palmtree5 redbot/cogs/customcom/* @palmtree5
@ -55,9 +56,10 @@ tests/cogs/downloader/* @jack1142
# Setup, instance setup, and running the bot # Setup, instance setup, and running the bot
setup.py @tekulvw setup.py @tekulvw
redbot/__init__.py @tekulvw redbot/__init__.py @tekulvw
redbot/__main__.py @tekulvw redbot/__main__.py @tekulvw @mikeshardmind
redbot/setup.py @tekulvw redbot/setup.py @tekulvw
# Others # Others
.travis.yml @Kowlin .travis.yml @Kowlin
crowdin.yml @Kowlin crowdin.yml @Kowlin
.github/workflows/* @Kowlin

View File

@ -30,9 +30,8 @@ Red is an open source project. This means that each and every one of the develop
We love receiving contributions from our community. Any assistance you can provide with regards to bug fixes, feature enhancements, and documentation is more than welcome. We love receiving contributions from our community. Any assistance you can provide with regards to bug fixes, feature enhancements, and documentation is more than welcome.
# 2. Ground Rules # 2. Ground Rules
We've made a point to use [ZenHub](https://www.zenhub.com/) (a plugin for GitHub) as our main source of collaboration and coordination. Your experience contributing to Red will be greatly improved if you go get that plugin.
1. Ensure cross compatibility for Windows, Mac OS and Linux. 1. Ensure cross compatibility for Windows, Mac OS and Linux.
2. Ensure all Python features used in contributions exist and work in Python 3.7 and above. 2. Ensure all Python features used in contributions exist and work in Python 3.8.1 and above.
3. Create new tests for code you add or bugs you fix. It helps us help you by making sure we don't accidentally break anything :grinning: 3. Create new tests for code you add or bugs you fix. It helps us help you by making sure we don't accidentally break anything :grinning:
4. Create any issues for new features you'd like to implement and explain why this feature is useful to everyone and not just you personally. 4. Create any issues for new features you'd like to implement and explain why this feature is useful to everyone and not just you personally.
5. Don't add new cogs unless specifically given approval in an issue discussing said cog idea. 5. Don't add new cogs unless specifically given approval in an issue discussing said cog idea.
@ -54,7 +53,7 @@ Red's repository is configured to follow a particular development workflow, usin
### 4.1 Setting up your development environment ### 4.1 Setting up your development environment
The following requirements must be installed prior to setting up: The following requirements must be installed prior to setting up:
- Python 3.7.0 or greater - Python 3.8.1 or greater
- git - git
- pip - pip
@ -80,10 +79,10 @@ If you're not on Windows, you should also have GNU make installed, and you can o
**Note:** If you're comfortable with setting up virtual environments yourself and would rather do it manually, just run `pip install -Ur tools/dev-requirements.txt` after setting it up. **Note:** If you're comfortable with setting up virtual environments yourself and would rather do it manually, just run `pip install -Ur tools/dev-requirements.txt` after setting it up.
### 4.2 Testing ### 4.2 Testing
We've recently started using [tox](https://github.com/tox-dev/tox) to run all of our tests. It's extremely simple to use, and if you followed the previous section correctly, it is already installed to your virtual environment. We're using [tox](https://github.com/tox-dev/tox) to run all of our tests. It's extremely simple to use, and if you followed the previous section correctly, it is already installed to your virtual environment.
Currently, tox does the following, creating its own virtual environments for each stage: Currently, tox does the following, creating its own virtual environments for each stage:
- Runs all of our unit tests with [pytest](https://github.com/pytest-dev/pytest) on python 3.7 (test environment `py37`) - Runs all of our unit tests with [pytest](https://github.com/pytest-dev/pytest) on python 3.8 (test environment `py38`)
- Ensures documentation builds without warnings, and all hyperlinks have a valid destination (test environment `docs`) - Ensures documentation builds without warnings, and all hyperlinks have a valid destination (test environment `docs`)
- Ensures that the code meets our style guide with [black](https://github.com/ambv/black) (test environment `style`) - Ensures that the code meets our style guide with [black](https://github.com/ambv/black) (test environment `style`)
@ -96,7 +95,7 @@ Your PR will not be merged until all of these tests pass.
### 4.3 Style ### 4.3 Style
Our style checker of choice, [black](https://github.com/ambv/black), actually happens to be an auto-formatter. The checking functionality simply detects whether or not it would try to reformat something in your code, should you run the formatter on it. For this reason, we recommend using this tool as a formatter, regardless of any disagreements you might have with the style it enforces. Our style checker of choice, [black](https://github.com/ambv/black), actually happens to be an auto-formatter. The checking functionality simply detects whether or not it would try to reformat something in your code, should you run the formatter on it. For this reason, we recommend using this tool as a formatter, regardless of any disagreements you might have with the style it enforces.
Use the command `black --help` to see how to use this tool. The full style guide is explained in detail on [black's GitHub repository](https://github.com/ambv/black). **There is one exception to this**, however, which is that we set the line length to 99, instead of black's default 88. When using `black` on the command line, simply use it like so: `black -l 99 -N <src>`. Use the command `black --help` to see how to use this tool. The full style guide is explained in detail on [black's GitHub repository](https://github.com/ambv/black). **There is one exception to this**, however, which is that we set the line length to 99, instead of black's default 88. This is already set in `pyproject.toml` configuration file in the repo so you can simply format code with Black like so: `black <src>`.
### 4.4 Make ### 4.4 Make
You may have noticed we have a `Makefile` and a `make.bat` in the top-level directory. For now, you can do a few things with them: You may have noticed we have a `Makefile` and a `make.bat` in the top-level directory. For now, you can do a few things with them:
@ -107,7 +106,7 @@ You may have noticed we have a `Makefile` and a `make.bat` in the top-level dire
The other make recipes are most likely for project maintainers rather than contributors. The other make recipes are most likely for project maintainers rather than contributors.
You can specify the Python executable used in the make recipes with the `PYTHON` environment variable, e.g. `make PYTHON=/usr/bin/python3.7 newenv`. You can specify the Python executable used in the make recipes with the `PYTHON` environment variable, e.g. `make PYTHON=/usr/bin/python3.8 newenv`.
### 4.5 Keeping your dependencies up to date ### 4.5 Keeping your dependencies up to date
Whenever you pull from upstream (V3/develop on the main repository) and you notice either of the files `setup.cfg` or `tools/dev-requirements.txt` have been changed, it can often mean some package dependencies have been updated, added or removed. To make sure you're testing and formatting with the most up-to-date versions of our dependencies, run `make syncenv`. You could also simply do `make newenv` to install them to a clean new virtual environment. Whenever you pull from upstream (V3/develop on the main repository) and you notice either of the files `setup.cfg` or `tools/dev-requirements.txt` have been changed, it can often mean some package dependencies have been updated, added or removed. To make sure you're testing and formatting with the most up-to-date versions of our dependencies, run `make syncenv`. You could also simply do `make newenv` to install them to a clean new virtual environment.

26
.github/workflows/auto_labeler.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Auto Labeler
on:
issues:
types: [opened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Apply Triage Label
uses: actions/github-script@0.4.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const is_status_label = (label) => label.name.startsWith('Status: ');
if (context.payload.issue.labels.some(is_status_label)) {
console.log('Issue already has Status label, skipping...');
return;
}
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Status: Needs Triage']
});

26
.github/workflows/lint_python.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Lint Python
on:
pull_request:
push:
repository_dispatch:
types:
- dispatched_test
env:
ref: ${{ github.event.client_payload.ref || '' }}
jobs:
lint_python:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.ref }}
- uses: actions/setup-python@v1
with:
python_version: "3.8"
- run: "python -m pip install git+https://github.com/pycqa/pyflakes@1911c20#egg=pyflakes git+https://github.com/pycqa/pycodestyle@d219c68#egg=pycodestyle git+https://gitlab.com/pycqa/flake8@3.7.9#egg=flake8"
name: Install Flake8
- run: "python -m flake8 . --count --select=E9,F7,F82 --show-source"
name: Flake8 Linting

55
.github/workflows/publish_crowdin.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: Publish to Crowdin
on:
schedule:
- cron: '0 12 * * THU'
repository_dispatch:
types: crowdin
env:
CROWDIN_API_KEY: ${{ secrets.crowdin_token}}
CROWDIN_PROJECT_ID: ${{ secrets.crowdin_identifier }}
jobs:
deploy:
if: github.repository == 'Cog-Creators/Red-DiscordBot'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Install dependencies
run: |
curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list
sudo apt-get update -qq
sudo apt-get install -y crowdin
pip install redgettext==3.1
- name: Generate source files
run: |
make gettext
- name: Upload source files
run: |
make upload_translations
- name: Download translations
run: |
make download_translations
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Automated Crowdin downstream
title: "[i18n] Automated Crowdin downstream"
body: |
This is an automated PR.
Please ensure that there are no errors or invalid files are in the PR.
labels: "Automated PR, Category: i18n"
branch: "automated/i18n"
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.cogcreators_bot_repo_scoped }}
repository: Cog-Creators/Red-DiscordBot
event-type: dispatched_test
client-payload: '{"ref": "automated/i18n"}'

27
.github/workflows/publish_pypi.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Publish to PyPI
on:
push:
tags:
- "*"
jobs:
deploy:
if: github.repository == 'Cog-Creators/Red-DiscordBot'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

85
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,85 @@
name: Tests
on:
pull_request:
push:
repository_dispatch:
types:
- dispatched_test
env:
ref: ${{ github.event.client_payload.ref || '' }}
jobs:
tox:
runs-on: ubuntu-latest
strategy:
matrix:
python_version:
- "3.8"
tox_env:
- py
- style
- docs
include:
- tox_env: py
friendly_name: Tests
- tox_env: style
friendly_name: Style
- tox_env: docs
friendly_name: Docs
fail-fast: false
name: Tox - ${{ matrix.friendly_name }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.ref }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Tox test
env:
TOXENV: ${{ matrix.tox_env }}
run: tox
tox-postgres:
runs-on: ubuntu-latest
strategy:
matrix:
python_version:
- "3.8"
fail-fast: false
name: Tox - Postgres
services:
postgresql:
image: postgres:10
ports:
- 5432:5432
env:
POSTGRES_DB: red_db
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.ref }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Tox test
env:
TOXENV: postgres
PGDATABASE: red_db
PGUSER: postgres
PGPASSWORD: postgres
PGPORT: 5432
run: tox

3
.gitignore vendored
View File

@ -137,3 +137,6 @@ ENV/
# pytest # pytest
.pytest_cache/ .pytest_cache/
# Pre-commit hooks
/.pre-commit-config.yaml

View File

@ -7,7 +7,7 @@ build:
image: latest image: latest
python: python:
version: 3.7 version: 3.8
install: install:
- requirements: docs/requirements.txt - requirements: docs/requirements.txt
- method: pip - method: pip

View File

@ -5,7 +5,7 @@ notifications:
email: false email: false
python: python:
- 3.7.3 - 3.8.1
env: env:
global: global:
- PIPENV_IGNORE_VIRTUALENVS=1 - PIPENV_IGNORE_VIRTUALENVS=1
@ -30,10 +30,10 @@ jobs:
# These jobs only occur on tag creation if the prior ones succeed # These jobs only occur on tag creation if the prior ones succeed
- stage: PyPi Deployment - stage: PyPi Deployment
if: tag IS present if: tag IS present
python: 3.7.2 python: 3.8.1
env: env:
- DEPLOYING=true - DEPLOYING=true
- TOXENV=py36 - TOXENV=py38
deploy: deploy:
- provider: pypi - provider: pypi
distributions: sdist bdist_wheel distributions: sdist bdist_wheel
@ -45,11 +45,11 @@ jobs:
repo: Cog-Creators/Red-DiscordBot repo: Cog-Creators/Red-DiscordBot
tags: true tags: true
- stage: Crowdin Deployment - stage: Crowdin Deployment
if: tag IS present if: tag IS present OR ENV(BUILD_CROWDIN)
python: 3.7.2 python: 3.8.1
env: env:
- DEPLOYING=true - DEPLOYING=true
- TOXENV=py36 - TOXENV=py38
before_deploy: before_deploy:
- curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add - - curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
- echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list - echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list

View File

@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
Red - A fully customizable Discord bot Red - A fully customizable Discord bot
Copyright (C) 2015-2019 Twentysix Copyright (C) 2015-2020 Twentysix
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode: notice like this when it starts in an interactive mode:
Red-DiscordBot Copyright (C) 2015-2019 Twentysix Red-DiscordBot Copyright (C) 2015-2020 Twentysix
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.

View File

@ -1,16 +1,17 @@
PYTHON ?= python3.7 PYTHON ?= python3.8
# Python Code Style # Python Code Style
reformat: reformat:
$(PYTHON) -m black -l 99 --target-version py37 `git ls-files "*.py"` $(PYTHON) -m black `git ls-files "*.py"`
stylecheck: stylecheck:
$(PYTHON) -m black --check -l 99 --target-version py37 `git ls-files "*.py"` $(PYTHON) -m black --check `git ls-files "*.py"`
stylediff:
$(PYTHON) -m black --check --diff `git ls-files "*.py"`
# Translations # Translations
gettext: gettext:
$(PYTHON) -m redgettext --command-docstrings --verbose --recursive redbot --exclude-files "redbot/pytest/**/*" $(PYTHON) -m redgettext --command-docstrings --verbose --recursive redbot --exclude-files "redbot/pytest/**/*"
upload_translations: upload_translations:
$(MAKE) gettext
crowdin upload sources crowdin upload sources
download_translations: download_translations:
crowdin download crowdin download

View File

@ -16,7 +16,7 @@
<img src="https://img.shields.io/badge/Support-Red!-yellow.svg" alt="Support Red on Patreon!"> <img src="https://img.shields.io/badge/Support-Red!-yellow.svg" alt="Support Red on Patreon!">
</a> </a>
<a href="https://www.python.org/downloads/"> <a href="https://www.python.org/downloads/">
<img src="https://img.shields.io/badge/Made%20With-Python%203.7-blue.svg?style=for-the-badge" alt="Made with Python 3.7"> <img src="https://img.shields.io/badge/Made%20With-Python%203.8-blue.svg?style=for-the-badge" alt="Made with Python 3.8">
</a> </a>
<a href="https://crowdin.com/project/red-discordbot"> <a href="https://crowdin.com/project/red-discordbot">
<img src="https://d322cqt584bo4o.cloudfront.net/red-discordbot/localized.svg" alt="Localized with Crowdin"> <img src="https://d322cqt584bo4o.cloudfront.net/red-discordbot/localized.svg" alt="Localized with Crowdin">
@ -26,8 +26,8 @@
</a> </a>
</p> </p>
<p align="center"> <p align="center">
<a href="https://travis-ci.com/Cog-Creators/Red-DiscordBot"> <a href="https://github.com/Cog-Creators/Red-DiscordBot/actions">
<img src="https://api.travis-ci.com/Cog-Creators/Red-DiscordBot.svg?branch=V3/develop" alt="Travis CI"> <img src="https://github.com/Cog-Creators/Red-DiscordBot/workflows/Tests/badge.svg" alt="GitHub Actions">
</a> </a>
<a href="http://red-discordbot.readthedocs.io/en/stable/?badge=stable"> <a href="http://red-discordbot.readthedocs.io/en/stable/?badge=stable">
<img src="https://readthedocs.org/projects/red-discordbot/badge/?version=stable" alt="Red on readthedocs.org"> <img src="https://readthedocs.org/projects/red-discordbot/badge/?version=stable" alt="Red on readthedocs.org">

View File

@ -1,2 +0,0 @@
Start the user guides covering cogs and the user interface of the bot. This
includes, for now, a "Getting started" guide.

View File

@ -1 +0,0 @@
Added documentation for PM2 support.

View File

@ -1 +0,0 @@
Add the option to modify the RPC port with the ``--rpc-port`` flag.

View File

@ -1 +0,0 @@
Updated linux install docs, adding sections for Fedora Linux, Debian/Raspbian Buster, and openSUSE.

View File

@ -1 +0,0 @@
Tests now use same event loop policy as Red's code.

View File

@ -1 +0,0 @@
Added functions to acquire locks on Config groups and values. These locks are acquired by default when calling a value as a context manager. See :meth:`Value.get_lock` for details

View File

@ -1 +0,0 @@
Added a config driver for PostgreSQL

View File

@ -1,32 +0,0 @@
Changes to the ``redbot.core.drivers`` package:
- The modules inside the ``redbot.core.drivers`` package no longer have the ``red_`` prefix in front of their names.
- All driver classes are now directly accessible as attributes to the ``redbot.core.drivers`` package.
- :func:`get_driver`'s signature has been changed.
- :func:`get_driver` can now use data manager to infer the backend type if it is not supplied as an argument.
- :func:`get_driver_class` has been added.
Changes to the :class:`BaseDriver` and :class:`JsonDriver` classes class:
- :meth:`BaseDriver.get_config_details` is an now abstract staticmethod.
- :meth:`BaseDriver.initialize` and :meth:`BaseDriver.teardown` are two new abstract coroutine classmethods.
- :meth:`BaseDriver.delete_all_data` is a new concrete (but overrideable) coroutine instance method.
- :meth:`BaseDriver.aiter_cogs` is a new abstract asynchronous iterator method.
- :meth:`BaseDriver.migrate_to` is a new concrete coroutine classmethod.
- :class:`JsonDriver` no longer requires the data path when constructed and will infer the data path from data manager.
Changes to the :class:`IdentifierData` class and :class:`ConfigCategory` enum:
- ``IdentifierData.custom_group_data`` has been replaced by :attr:`IdentifierData.primary_key_len`.
- :meth:`ConfigCategory.get_pkey_info` is a new classmethod.
Changes to the migration and backup system:
- All code in the ``redbot.setup`` script, excluding that regarding MongoV1, is now virtually backend-agnostic.
- All code in the ``[p]backup`` is now backend-agnostic.
- :func:`redbot.core.config.migrate` is a new coroutine function.
- All a new driver needs to do now to be compatible with migrations and backups is to implement the :class:`BaseDriver` ABC.
Enhancements to unit tests:
- New tox recipes have been added for testing against Mongo and Postgres backends. See the ``tox.ini`` file for clues on how to run them.

View File

@ -1,9 +0,0 @@
Adds methods to Config for accessing things by id without mocked objects
- Config.guild_from_id
- Config.user_from_id
- Config.role_from_id
- Config.channel_from_id
- Config.member_from_ids
- This one requires multiple ids, one for the guild, one for the user
- Consequence of discord's object model

View File

@ -1 +0,0 @@
New :func:`humanize_number` in :module:`redbot.core.utils.chat_formatting` function to convert numbers into text which respect locale.

View File

@ -1 +0,0 @@
New :func:`humanize_number` is used throughout the bot.

View File

@ -1,5 +0,0 @@
Added New commands to Economy
- ``[p]bank prune user`` - This will delete a user's bank account.
- ``[p]bank prune local`` - This will prune the bank of accounts from users no longer in the server.
- ``[p]bank prune global`` - This will prune the global bank of accounts from users who do not share any servers with the bot.

View File

@ -1,3 +0,0 @@
Added :func:`bank_prune` to :module:`redbot.core.bank`
- :func:`bank_prune` can be used to delete a specific user's bank account or remove all invalid bank accounts (For users who are not in the guild if bank is local or share servers with the bot if bank is global).

View File

@ -1,2 +0,0 @@
Added the function ``redbot.core.utils.chat_formatting.text_to_file`` to
prepare a long text to be send as a file.

View File

@ -1 +0,0 @@
Help properly hides disabled commands.

View File

@ -1 +0,0 @@
Red now uses towncrier for changelog generation

View File

@ -1 +0,0 @@
Slots now has a 62.5% expected payout and won't inflate economy when spammed.

View File

@ -1 +0,0 @@
Allow passing cls in the :func:`redbot.core.commands.group()` decorator

View File

@ -1 +0,0 @@
Create documentation covering what we consider a developer facing breaking change and guarantees regarding them.

View File

@ -1 +0,0 @@
[Tunnel] Added ``use_cached`` and ``images_only`` kwargs to `redbot.core.utils.Tunnel.files_from_attach`

View File

@ -1 +0,0 @@
Fixed remove_command error when trying to remove a non-existent command

View File

@ -1 +0,0 @@
``Command.can_see`` now works as intended for disabled commands

View File

@ -1 +0,0 @@
Red's Help Formatter is now considered to have a stable API.

View File

@ -1 +0,0 @@
Modlog casetypes no longer have an attribute for auditlog action type.

View File

@ -1 +0,0 @@
Modlog entries now show up properly without the mod cog loaded

View File

@ -1 +0,0 @@
Modlog no longer generates cases without being told to for actions the bot did.

View File

@ -1 +0,0 @@
Some generic modlog casetypes are now pre-registered for cog creator use

View File

@ -1 +0,0 @@
``redbot.core.modlog.get_next_case_number()`` has been removed.

View File

@ -1 +0,0 @@
Fixed error in `[p]reason` when setting the reason for a case without a moderator.

View File

@ -1 +0,0 @@
ModLog is now much faster at creating cases, especially in large servers.

View File

@ -1 +0,0 @@
Added :func:`redbot.core.modlog.get_latest_case` to fetch the case object for the most recent ModLog case.

View File

@ -1 +0,0 @@
Fixed user parameter being labeled as discord.TextChannel instead of discord.abc.User.

View File

@ -1 +0,0 @@
Updated towncrier info in contribution guidelines to include how to do a standalone PR.

View File

@ -1 +0,0 @@
Reworded virtual environment guide to make it sound less scary.

View File

@ -1 +0,0 @@
JSON config files are now stored without indentation, this is to reduce file size and increase performance of write operations.

View File

@ -1 +0,0 @@
Check the recipient balance before transferring and stop transfer if will go above the maximum allowed balance.

View File

@ -1 +0,0 @@
Fixed Requires docs inconsistencies

View File

@ -1 +0,0 @@
Removed :cons:`bank.MAX_BALANCE`, use :meth:`bank.get_max_balance()` from now.

View File

@ -1 +0,0 @@
`[p]bankset maxbal` can be used to set the maximum bank balance.

View File

@ -1 +0,0 @@
The ``set owner`` and ``set token`` commands have been removed in favor of managing server side.

View File

@ -1 +0,0 @@
Updated dependencies, most notably PyYAML, tqdm, uvloop and pymongo.

View File

@ -1 +0,0 @@
Setting the ``PYTHON`` env var whilst running ``make`` now allows you to specify which python executable to use.

View File

@ -1 +0,0 @@
Add `pip-wheel-metadata` folder to `.gitignore` file - pip creates it when installing Red in venv

View File

@ -1 +0,0 @@
The [p]invite command no longer errors when a user has the bot blocked or DMs disabled in the server.

View File

@ -1 +0,0 @@
Renamed two changelog files from fix to bugfix.

View File

@ -1 +0,0 @@
Fixed a typo in CONTRIBUTING.md.

View File

@ -1 +0,0 @@
Stop using `:` character in backup's filename - Windows doesn't accept it

View File

@ -1 +0,0 @@
``redbot-setup delete`` no longer errors about "unexpected keyword argument"

View File

@ -1 +0,0 @@
``redbot-setup delete`` no longer prompts about backup when user passes ``--no-prompt`` option

View File

@ -1 +0,0 @@
``--[no-]backup``, ``--[no-]drop-db`` and ``--[no-]remove-datapath`` in ``redbot-setup delete`` command are now on/off flags.

View File

@ -1 +0,0 @@
Confirmation prompts in ``redbot-setup`` now have default values for user convenience.

View File

@ -1 +0,0 @@
```redbot-setup delete`` now has the option to leave Red's data untouched on database backends.

View File

@ -1 +0,0 @@
[Core] Inviteset public and perms help string cleanup

View File

@ -1 +0,0 @@
Make embedset user only affect DM's

View File

@ -1,11 +0,0 @@
The main bot config is no longer directly accessible to cogs. New methods have been added for use where this is concerned.
New methods for this include
- ``bot.get_shared_api_tokens``
- ``bot.set_shared_api_tokens``
- ``bot.get_embed_color``
- ``bot.get_embed_colour``
- ``bot.get_admin_roles``
- ``bot.get_admin_role_ids``
- ``bot.get_mod_roles``
- ``bot.get_mod_role_ids``

View File

@ -1 +0,0 @@
Give friendly error when provided instance name doesn't exist.

View File

@ -1 +0,0 @@
Reserves some command names for internal Red use. These are available programatically as ``redbot.core.commands.RESERVED_COMMAND_NAMES``

View File

@ -1 +0,0 @@
Fixed the help text and response of `[p]set usebotcolor` to accurately reflect what the command is doing.

View File

@ -1 +0,0 @@
Removes bot._counter, Makes a few more attrs private (cog_mgr, main_dir)

View File

@ -1,6 +0,0 @@
adds a few methods and classes replacing direct config access (which is no longer supported)
- ``redbot.core.Red.allowed_by_whitelist_blacklist``
- ``redbot.core.Red.get_valid_prefixes``
- ``redbot.core.Red.clear_shared_api_tokens``
- ``redbot.core.commands.help.HelpSettings``

View File

@ -1 +0,0 @@
Bot no longer types infinitely when command with cooldown is called within last second of cooldown.

View File

@ -1 +0,0 @@
Added more information about ``redbot.core.utils.humanize_timedelta`` into the docs

View File

@ -1 +0,0 @@
Updated the typing of ``redbot.core.utils.humanize_timedelta`` to be more accurate.

View File

@ -1 +0,0 @@
Add direct link to "Installing Red" section in "Installing using powershell and chocolatey"

View File

@ -1 +0,0 @@
Fixed a crash seen when calling economy commands in DM with a global bank.

View File

@ -1 +0,0 @@
Update Git PATH install (Windows), capitalise some words, don't mention to launcher

View File

@ -1 +0,0 @@
remove f-string usage in launcher to prevent our error handling from cauing an error.

View File

@ -1 +0,0 @@
Fixed MessagePredicate.greater and MessagePredicate.less allowing any valid int instead of only valid ints/floats that are greater/less than the given value.

View File

@ -1 +0,0 @@
Adds autostart documentation for Red users who installed it inside a virtual environment.

View File

@ -1 +0,0 @@
Uptime command works with uptimes of under a second

View File

@ -1 +0,0 @@
update some UI to include copyright

View File

@ -1 +0,0 @@
Add quotation marks to helpset tagline's response so two consecutive full stops don't appear

View File

@ -1 +0,0 @@
Fixes an issue with clearing rules in permissions

View File

@ -1 +0,0 @@
fixes a missing await from #2976

View File

@ -1 +0,0 @@
Update Cog Creation guide with a note regarding the Develop version as well as folder layout for local cogs

View File

@ -1 +0,0 @@
cog install will no longer error if a cog creator has an empty install message

View File

@ -1 +0,0 @@
Link to Getting started guide at the end of installation guides.

View File

@ -1 +0,0 @@
Lavalink will now be restarted after unexpected shutdown.

View File

@ -1 +0,0 @@
Add 3rd-party lib folder to ``sys.path`` before loading cogs. This prevents issues with 3rd-party cogs failing to load without loaded Downloader due to unavailable requirements.

View File

@ -1 +0,0 @@
Bot now handles more things prior to connecting to discord to reduce issues with initial load

View File

@ -1 +0,0 @@
``bot.send_filtered`` now returns the message that is sent.

View File

@ -1 +0,0 @@
Discord.py docs links will now always use docs for currently used version of discord.py.

View File

@ -1 +0,0 @@
Add ``|DPY_VERSION|`` substitution that will automatically get replaced by current discord.py version.

View File

@ -1 +0,0 @@
Add missing descriptions for function returns.

View File

@ -1 +0,0 @@
Bot will now properly send a message when the invoked command is guild-only.

Some files were not shown because too many files have changed in this diff Show More