From 6ad4ec4a60082692ec20bbb98a10c39915a4dfaf Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Sat, 5 Aug 2023 03:28:20 +0200 Subject: [PATCH] Add pre-commit configuration, some new checks and reformat (#50) * Add flake8 configuration * Add pyproject.toml * Remove max line length from make files * Run Black * Fix End of Files * Trim trailing whitespace * Pretty format JSON * Add pre-commit configuration * Update the GH Actions workflow to run pre-commit * Add various Problem Matchers * Update Flake8 URL to github * Downgrade formatter version for black's required-version * fix python-version, update actions, add required-version * bump version * reformat! * fortunately, this will be squashed... --------- Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: Neuro Assassin --- .flake8 | 4 ++ .github/workflows/lint_python.yaml | 26 ---------- .github/workflows/matchers/check-json.json | 17 +++++++ .github/workflows/matchers/check-toml.json | 16 +++++++ .github/workflows/matchers/check-yaml.json | 19 ++++++++ .github/workflows/matchers/flake8.json | 32 +++++++++++++ .github/workflows/run_precommit.yml | 41 ++++++++++++++++ .github/workflows/style.yaml | 17 ------- .pre-commit-config.yaml | 55 ++++++++++++++++++++++ LICENSE | 2 +- Makefile | 6 +-- README.md | 2 +- authgg/authgg.py | 2 +- authgg/info.json | 2 +- color/info.json | 25 ++++++---- commandchart/commandchart.py | 4 +- commandchart/info.json | 24 ++++++---- cooldown/cooldown.py | 9 ++-- cooldown/info.json | 2 +- dashboard/abc/mixin.py | 2 +- dashboard/abc/roles.py | 2 +- dashboard/abc/webserver.py | 4 +- dashboard/dashboard.py | 1 - dashboard/info.json | 2 +- dashboard/rpc/permissions.py | 8 ++-- deleter/deleter.py | 6 ++- deleter/info.json | 22 +++++---- editor/info.json | 22 +++++---- esolang/befunge.py | 3 +- esolang/cow.py | 1 - esolang/esolang.py | 10 ++-- esolang/info.json | 2 +- esolang/whitespace.py | 6 ++- evolution/bank.py | 2 +- evolution/evolution.py | 5 +- evolution/info.json | 24 ++++++---- evolution/utils.py | 2 +- grammar/converters.py | 2 +- grammar/info.json | 22 +++++---- info.json | 19 +++++--- listpermissions/info.json | 25 ++++++---- maintenance/converters.py | 4 +- maintenance/info.json | 20 ++++---- maintenance/maintenance.py | 3 +- make.bat | 8 ++-- minesweeper/info.json | 22 +++++---- minesweeper/minesweeper.py | 8 ++-- opensea/info.json | 2 +- opensea/opensea.py | 2 +- pyproject.toml | 3 ++ reacticket/extensions/base.py | 4 +- reacticket/extensions/mixin.py | 7 ++- reacticket/extensions/views/ticket.py | 10 ++-- reacticket/info.json | 2 +- reacticket/reacticket.py | 4 +- requirements.txt | 2 +- scanner/info.json | 22 +++++---- scanner/scanner.py | 15 +++--- simon/info.json | 22 +++++---- simon/simon.py | 5 +- sw/info.json | 21 +++++---- sw/sw.py | 20 ++++---- targeter/info.json | 22 +++++---- targeter/targeter.py | 4 +- twenty/info.json | 22 +++++---- updatechecker/info.json | 24 ++++++---- updatechecker/updatechecker.py | 7 ++- 67 files changed, 508 insertions(+), 274 deletions(-) create mode 100644 .flake8 delete mode 100644 .github/workflows/lint_python.yaml create mode 100644 .github/workflows/matchers/check-json.json create mode 100644 .github/workflows/matchers/check-toml.json create mode 100644 .github/workflows/matchers/check-yaml.json create mode 100644 .github/workflows/matchers/flake8.json create mode 100644 .github/workflows/run_precommit.yml delete mode 100644 .github/workflows/style.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..a8ca6316 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 99 +select = E9,F7,F82 +extend-exclude=.venv/,.stubs/ diff --git a/.github/workflows/lint_python.yaml b/.github/workflows/lint_python.yaml deleted file mode 100644 index 18b1b4f4..00000000 --- a/.github/workflows/lint_python.yaml +++ /dev/null @@ -1,26 +0,0 @@ -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 \ No newline at end of file diff --git a/.github/workflows/matchers/check-json.json b/.github/workflows/matchers/check-json.json new file mode 100644 index 00000000..0b49ade5 --- /dev/null +++ b/.github/workflows/matchers/check-json.json @@ -0,0 +1,17 @@ +{ + "__comment": "Credits to: https://github.com/home-assistant/core/blob/d32c364d7f9e138e0dd9363b34b3cb39f4afcd06/.github/workflows/matchers/check-json.json", + "problemMatcher": [ + { + "owner": "check-json", + "pattern": [ + { + "regexp": "^(.+):\\s(Failed to json decode\\s.+\\sline\\s(\\d+)\\scolumn\\s(\\d+).+)$", + "file": 1, + "message": 2, + "line": 3, + "column": 4 + } + ] + } + ] +} diff --git a/.github/workflows/matchers/check-toml.json b/.github/workflows/matchers/check-toml.json new file mode 100644 index 00000000..a1a9b0e6 --- /dev/null +++ b/.github/workflows/matchers/check-toml.json @@ -0,0 +1,16 @@ +{ + "problemMatcher": [ + { + "owner": "check-toml", + "pattern": [ + { + "regexp": "^(.+\\.toml):\\s(.+line\\s(\\d+)\\scolumn\\s(\\d+).+)$", + "file": 1, + "message": 2, + "line": 3, + "column": 4 + } + ] + } + ] +} diff --git a/.github/workflows/matchers/check-yaml.json b/.github/workflows/matchers/check-yaml.json new file mode 100644 index 00000000..ae5446a3 --- /dev/null +++ b/.github/workflows/matchers/check-yaml.json @@ -0,0 +1,19 @@ +{ + "problemMatcher": [ + { + "owner": "check-yaml", + "pattern": [ + { + "regexp": "^(.+)$", + "message": 1 + }, + { + "regexp": "^ in \"(.+\\.ya?ml)\", line (\\d+), column (\\d+)$", + "file": 1, + "line": 2, + "column": 3 + } + ] + } + ] +} diff --git a/.github/workflows/matchers/flake8.json b/.github/workflows/matchers/flake8.json new file mode 100644 index 00000000..4738c2ec --- /dev/null +++ b/.github/workflows/matchers/flake8.json @@ -0,0 +1,32 @@ +{ + "__comment": "Credits to: https://github.com/home-assistant/core/blob/d32c364d7f9e138e0dd9363b34b3cb39f4afcd06/.github/workflows/matchers/flake8.json", + "problemMatcher": [ + { + "owner": "flake8-error", + "severity": "error", + "pattern": [ + { + "regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{3})\\s.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + "code": 5 + } + ] + }, + { + "owner": "flake8-warning", + "severity": "warning", + "pattern": [ + { + "regexp": "^(.+):(\\d+):(\\d+):\\s(([CDNW]\\d{3})\\s.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/workflows/run_precommit.yml b/.github/workflows/run_precommit.yml new file mode 100644 index 00000000..cedf97a0 --- /dev/null +++ b/.github/workflows/run_precommit.yml @@ -0,0 +1,41 @@ +name: Run pre-commit + +on: [push, pull_request] + +jobs: + run_precommit: + name: Run pre-commit + runs-on: ubuntu-latest + + steps: + # Checkout repository + - uses: actions/checkout@v3 + + # Setup Python and install pre-commit + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Install pre-commit + run: | + pip install -U pre-commit + + # Load cached pre-commit environment + - name: set PY + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + + # Register problem matchers + - name: Register problem matchers + run: | + echo "::add-matcher::.github/workflows/matchers/check-json.json" + echo "::add-matcher::.github/workflows/matchers/check-toml.json" + echo "::add-matcher::.github/workflows/matchers/check-yaml.json" + echo "::add-matcher::.github/workflows/matchers/flake8.json" + + # Run pre-commit + - name: Run pre-commit + run: | + pre-commit run --show-diff-on-failure --color=never --all-files --verbose diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml deleted file mode 100644 index 3331f082..00000000 --- a/.github/workflows/style.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Style formatting - -on: [push, pull_request] - -jobs: - mypy: - name: Style check with Black - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - with: - python-version: "3.8" - - run: "python -m pip install black==19.10b0" - name: Install dependencies - - run: "make stylediff" - name: Run black \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..b1b76b36 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,55 @@ +default_language_version: + python: python3.8 +exclude: ^.stubs/ +repos: + - repo: https://github.com/psf/black + rev: 'refs/tags/23.7.0:refs/tags/23.7.0' + hooks: + - id: black + - repo: https://github.com/Pierre-Sassoulas/black-disable-checker + rev: 'v1.1.3' + hooks: + - id: black-disable-checker + - repo: https://github.com/pycqa/flake8 + rev: '6.1.0' + hooks: + - id: flake8 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + # `.gitattributes` should technically already handle this + # but autocrlf can result in local files keeping the CRLF + # which is problematic for codespell + - id: end-of-file-fixer + # normally you would want this but Neuro is not very consistent :P + # - id: mixed-line-ending + # args: + # - "--fix=lf" + + # Trailing whitespace is evil + - id: trailing-whitespace + + # Require literal syntax when initializing builtin types + - id: check-builtin-literals + + # Ensure that links to code on GitHub use the permalinks + - id: check-vcs-permalinks + + # Syntax validation + - id: check-ast + - id: check-json + - id: check-toml + # can be switched to yamllint when this issue gets resolved: + # https://github.com/adrienverge/yamllint/issues/238 + - id: check-yaml + + # JSON auto-formatter + - id: pretty-format-json + args: + - "--autofix" + - "--indent=4" + - "--no-sort-keys" + + # Checks for git-related issues + - id: check-case-conflict + - id: check-merge-conflict diff --git a/LICENSE b/LICENSE index 0ad9207c..6f4015b8 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/Makefile b/Makefile index b0419e6d..4c3a2cfe 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ PYTHON ?= python3.8 # Python Code Style reformat: - $(PYTHON) -m black -l 99 . + $(PYTHON) -m black . stylecheck: - $(PYTHON) -m black --check -l 99 . + $(PYTHON) -m black --check . stylediff: - $(PYTHON) -m black --check --diff -l 99 . \ No newline at end of file + $(PYTHON) -m black --check --diff . diff --git a/README.md b/README.md index 02805830..7c1f3fcd 100644 --- a/README.md +++ b/README.md @@ -78,4 +78,4 @@ For bugs, contact me at Neuro Assassin#4779 <@473541068378341376>. It would be [PrettyTable](https://pypi.org/project/PrettyTable/) and [FuzzyWuzzy](https://pypi.org/project/fuzzywuzzy/) are required for the listpermissions cog. -[Back to Table of Contents](#table-of-contents) \ No newline at end of file +[Back to Table of Contents](#table-of-contents) diff --git a/authgg/authgg.py b/authgg/authgg.py index 36667271..360d8af5 100644 --- a/authgg/authgg.py +++ b/authgg/authgg.py @@ -50,7 +50,7 @@ async def authgg(self, ctx): @authgg.command() async def resethwid(self, ctx, apikey: str, *, name: Optional[str] = None): """Reset a user's HWID lock on auth.gg for the specified API key name. - + The API key name must be the friendly name provided by `[p]authgg keys add`.""" if not await self.bot.is_owner(ctx.author): roles = await self.conf.roles() diff --git a/authgg/info.json b/authgg/info.json index cd842117..bb97f7d0 100644 --- a/authgg/info.json +++ b/authgg/info.json @@ -11,4 +11,4 @@ ], "requirements": [], "hidden": false -} \ No newline at end of file +} diff --git a/color/info.json b/color/info.json index 2befbef9..64b28a53 100644 --- a/color/info.json +++ b/color/info.json @@ -1,10 +1,17 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog. In-message shortcuts are disabled by guild by default. An administrator can change this rule by running `[p]color msgshort true`", - "name" : "color", - "short" : "Tells you the hexadecimal values, rgb values and names of colors", - "description" : "This cog will tell you the hexadecimal value, rgb value and the name of the color that is supplied to it.", - "tags" : ["tools"], - "requirements" : ["colour", "pillow"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog. In-message shortcuts are disabled by guild by default. An administrator can change this rule by running `[p]color msgshort true`", + "name": "color", + "short": "Tells you the hexadecimal values, rgb values and names of colors", + "description": "This cog will tell you the hexadecimal value, rgb value and the name of the color that is supplied to it.", + "tags": [ + "tools" + ], + "requirements": [ + "colour", + "pillow" + ], + "hidden": false +} diff --git a/commandchart/commandchart.py b/commandchart/commandchart.py index dae5b60f..1d6bd7a7 100644 --- a/commandchart/commandchart.py +++ b/commandchart/commandchart.py @@ -6,7 +6,7 @@ """ MIT License -Copyright (c) 2018-Present NeuroAssassin +Copyright (c) 2018-Present NeuroAssassin Copyright (c) 2016-present aikaterna Permission is hereby granted, free of charge, to any person obtaining a copy @@ -131,7 +131,7 @@ def create_chart(self, top, others, channel): @commands.guild_only() @commands.command() async def commandchart( - self, ctx, channel: typing.Optional[discord.TextChannel] = None, number: int = 5000, + self, ctx, channel: typing.Optional[discord.TextChannel] = None, number: int = 5000 ): """See the used commands in a certain channel within a certain amount of messages.""" e = discord.Embed(description="Loading...", color=0x000099) diff --git a/commandchart/info.json b/commandchart/info.json index cc61695f..ddd3cb55 100644 --- a/commandchart/info.json +++ b/commandchart/info.json @@ -1,10 +1,16 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "commandchart", - "short" : "Tells the used and usages of commands! Based off of aikaterna's chatchart cog.", - "description" : "This cog tells a Discord User the commands used, and the usage of them, in the last so and so messages. Based off of aikaterna's chatchart cog.", - "tags" : ["tools"], - "requirements" : ["matplotlib"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "commandchart", + "short": "Tells the used and usages of commands! Based off of aikaterna's chatchart cog.", + "description": "This cog tells a Discord User the commands used, and the usage of them, in the last so and so messages. Based off of aikaterna's chatchart cog.", + "tags": [ + "tools" + ], + "requirements": [ + "matplotlib" + ], + "hidden": false +} diff --git a/cooldown/cooldown.py b/cooldown/cooldown.py index 3f85bca1..1bd0a310 100644 --- a/cooldown/cooldown.py +++ b/cooldown/cooldown.py @@ -34,7 +34,8 @@ class Cooldown(commands.Cog): WARNING: Some cooldowns are meant to be in place, meaning that they should not be removed. Any contributors to this cog are not at fault if it is used improperly, and is instead at - the fault of the person running the command. By installing this cog, you agree to these terms.""" + the fault of the person running the command. By installing this cog, you agree to these terms. + """ def __init__(self, bot): self.bot = bot @@ -99,7 +100,8 @@ async def add(self, ctx, rate: int, per, btype, *, command): - Rate: how many times - Per: during how long - Type: for what type - - Command: for what command. Do not use a prefix, and does not work with aliases. Please pass the actual command for the alias if you wish.""" + - Command: for what command. Do not use a prefix, and does not work with aliases. Please pass the actual command for the alias if you wish. + """ ttype = None per = per.lower() np = per[:-1] @@ -191,7 +193,8 @@ async def remove(self, ctx, *, command): Please do note however: some commands are meant to have cooldowns. They may prevent something malicious from happening, or maybe your device from breaking or from being used too much. I (Neuro Assassin <@473541068378341376>) or any other contributor to this cog take no responsibility for any complications that may result because of this. Use at your own risk. - Note: Does not actually remove the command cooldown (undocumented), so instead it allows for the command to be run 100000 times every 1 second until the next boot up, where it will not be added (unless you are removing a cooldown from outside of this cog, then it will be kept after restart).""" + Note: Does not actually remove the command cooldown (undocumented), so instead it allows for the command to be run 100000 times every 1 second until the next boot up, where it will not be added (unless you are removing a cooldown from outside of this cog, then it will be kept after restart). + """ cmd = self.bot.get_command(command) if cmd == None or not str(cmd) == command: return await ctx.send("Invalid command argument.") diff --git a/cooldown/info.json b/cooldown/info.json index 7964acc3..f738d47a 100644 --- a/cooldown/info.json +++ b/cooldown/info.json @@ -10,4 +10,4 @@ "tools" ], "hidden": false -} \ No newline at end of file +} diff --git a/dashboard/abc/mixin.py b/dashboard/abc/mixin.py index d473fe4a..eda0d0f2 100644 --- a/dashboard/abc/mixin.py +++ b/dashboard/abc/mixin.py @@ -8,6 +8,6 @@ async def dashboard(self, ctx: commands.Context): class DBMixin: - """ This is mostly here to easily mess with things... """ + """This is mostly here to easily mess with things...""" c = dashboard diff --git a/dashboard/abc/roles.py b/dashboard/abc/roles.py index cf9b12de..45d11b8e 100644 --- a/dashboard/abc/roles.py +++ b/dashboard/abc/roles.py @@ -182,7 +182,7 @@ async def perms(self, ctx: commands.Context): disallowed = await self.config.disallowedperms() if await ctx.embed_requested(): e = discord.Embed( - title="Dashboard permissions", description="", color=(await ctx.embed_color()), + title="Dashboard permissions", description="", color=(await ctx.embed_color()) ) for key, value in HUMANIZED_PERMISSIONS.items(): if key in disallowed: diff --git a/dashboard/abc/webserver.py b/dashboard/abc/webserver.py index 905ccf46..56cb9105 100644 --- a/dashboard/abc/webserver.py +++ b/dashboard/abc/webserver.py @@ -80,11 +80,11 @@ async def redirect(self, ctx: commands.Context, redirect: str): @webserver.command(hidden=True) async def clientid(self, ctx: commands.Context, cid: int): """Set the Client ID for after logging in via Discord OAuth. - + Note that this should almost never be used. This is only here for special cases where the Client ID is not the same as the bot ID. - + Pass 0 if you wish to revert to Bot ID.""" await ctx.send( "**Warning**\n\nThis command only exists for special cases. It is most likely that your client ID is your bot ID, which is the default. **Changing this will break Discord OAuth until reverted.** Are you sure you want to do this?" diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py index 01b4364c..6c44f3f7 100644 --- a/dashboard/dashboard.py +++ b/dashboard/dashboard.py @@ -33,7 +33,6 @@ class Dashboard( commands.Cog, metaclass=CompositeMetaClass, ): - __version__ = "0.1.8a" def __init__(self, bot: Red, *args, **kwargs): diff --git a/dashboard/info.json b/dashboard/info.json index 7fb80250..4d062c98 100644 --- a/dashboard/info.json +++ b/dashboard/info.json @@ -13,4 +13,4 @@ "markdown2" ], "hidden": true -} \ No newline at end of file +} diff --git a/dashboard/rpc/permissions.py b/dashboard/rpc/permissions.py index 8876fe01..45f667f0 100644 --- a/dashboard/rpc/permissions.py +++ b/dashboard/rpc/permissions.py @@ -173,7 +173,7 @@ async def add_default_rule( return {"status": 0, "message": "That command can not be restricted"} await cog._set_default_rule( - rule=cast(bool, allow_or_deny), cog_or_cmd=cog_or_command, guild_id=guild.id, + rule=cast(bool, allow_or_deny), cog_or_cmd=cog_or_command, guild_id=guild.id ) return {"status": 1} @@ -196,7 +196,7 @@ async def remove_rule( return {"status": 0, "message": "Invalid target"} await cog._remove_rule( - cog_or_cmd=cog_or_command, model_id=who_or_what.id, guild_id=guild.id, + cog_or_cmd=cog_or_command, model_id=who_or_what.id, guild_id=guild.id ) return {"status": 1} @@ -216,8 +216,6 @@ async def remove_default_rule( if isinstance(cog_or_command.obj, commands._AlwaysAvailableCommand): return {"status": 0, "message": "That command can not be restricted"} - await cog._set_default_rule( - rule=None, cog_or_cmd=cog_or_command, guild_id=guild.id, - ) + await cog._set_default_rule(rule=None, cog_or_cmd=cog_or_command, guild_id=guild.id) return {"status": 1} diff --git a/deleter/deleter.py b/deleter/deleter.py index 963f192f..9cc8807a 100644 --- a/deleter/deleter.py +++ b/deleter/deleter.py @@ -36,7 +36,8 @@ class Deleter(commands.Cog): """Set channels for their messages to be auto-deleted after a specified amount of time. - WARNING: This cog has potential API abuse AND SHOULD BE USED CAREFULLY! If you see any issues arise due to this, please report to Neuro Assassin or bot owner ASAP!""" + WARNING: This cog has potential API abuse AND SHOULD BE USED CAREFULLY! If you see any issues arise due to this, please report to Neuro Assassin or bot owner ASAP! + """ def __init__(self, bot): self.bot = bot @@ -98,7 +99,8 @@ async def on_message(self, message): async def deleter(self, ctx): """Group command for commands dealing with auto-timed deletion. - To see what channels are currently being tracked, use this command with no subcommands passed.""" + To see what channels are currently being tracked, use this command with no subcommands passed. + """ async with self.lock: channels = await self.conf.all_channels() sending = "" diff --git a/deleter/info.json b/deleter/info.json index d06be5df..cff84c43 100644 --- a/deleter/info.json +++ b/deleter/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "deleter", - "short" : "Allows for the auto-deletion of messages in a channel after a specified wait time.", - "description" : "Allows moderators to make messages be auto-deleted after a certain amount of time in a certain channel. WARNING: This cog has potential API abuse AND SHOULD BE USED CAREFULLY! If you see any issues arise due to this, please report to Neuro Assassin or bot owner ASAP!", - "tags" : ["tools"], - "requirements" : [], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "deleter", + "short": "Allows for the auto-deletion of messages in a channel after a specified wait time.", + "description": "Allows moderators to make messages be auto-deleted after a certain amount of time in a certain channel. WARNING: This cog has potential API abuse AND SHOULD BE USED CAREFULLY! If you see any issues arise due to this, please report to Neuro Assassin or bot owner ASAP!", + "tags": [ + "tools" + ], + "requirements": [], + "hidden": false +} diff --git a/editor/info.json b/editor/info.json index 041dc3e6..e4564d67 100644 --- a/editor/info.json +++ b/editor/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "editor", - "short" : "Edit one of the bot's messages easily.", - "description" : "Allows an administrator to change the text of one of the bot's messages, by either specifying the new content or by taking the content (and embed, if applicable) of another message.", - "tags" : ["tools"], - "requirements" : [], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "editor", + "short": "Edit one of the bot's messages easily.", + "description": "Allows an administrator to change the text of one of the bot's messages, by either specifying the new content or by taking the content (and embed, if applicable) of another message.", + "tags": [ + "tools" + ], + "requirements": [], + "hidden": false +} diff --git a/esolang/befunge.py b/esolang/befunge.py index 4ae7e4db..a0578cd1 100644 --- a/esolang/befunge.py +++ b/esolang/befunge.py @@ -50,7 +50,8 @@ def __init__(self, message: str, code: str): else: ptr = len(code) super().__init__( - message, ("program.befunge", 1, ptr, code), + message, + ("program.befunge", 1, ptr, code), ) diff --git a/esolang/cow.py b/esolang/cow.py index 7ea92496..f231c321 100644 --- a/esolang/cow.py +++ b/esolang/cow.py @@ -2,7 +2,6 @@ class COW: - instruction_mapping = { 0: "moo", 1: "mOo", diff --git a/esolang/esolang.py b/esolang/esolang.py index 355fe029..f3213386 100644 --- a/esolang/esolang.py +++ b/esolang/esolang.py @@ -127,8 +127,7 @@ async def whitespace(self, ctx, *, code): Since Discord auto-converts tabs to spaces, use EM QUAD instead. - If you need to copy it, here: `  -` + If you need to copy it, here: `\u2001` """ try: wrapped = functools.partial(Whitespace.evaluate, code=code) @@ -148,4 +147,9 @@ async def whitespace(self, ctx, *, code): else: output.seek(0) output = output.read() - await ctx.send(box(f"[Output]: {output}", lang="ini",)) + await ctx.send( + box( + f"[Output]: {output}", + lang="ini", + ) + ) diff --git a/esolang/info.json b/esolang/info.json index a970edcc..283ad78d 100644 --- a/esolang/info.json +++ b/esolang/info.json @@ -11,4 +11,4 @@ ], "requirements": [], "hidden": true -} \ No newline at end of file +} diff --git a/esolang/whitespace.py b/esolang/whitespace.py index cd64d225..72edc70b 100644 --- a/esolang/whitespace.py +++ b/esolang/whitespace.py @@ -15,7 +15,8 @@ def __init__(self, message: str, code: str, pointer: int): else: line = 0 super().__init__( - message, ("program.ws", line + 1, pointer + 1, code), + message, + ("program.ws", line + 1, pointer + 1, code), ) @@ -31,7 +32,8 @@ def __init__(self, message: str, code: str, pointer: int): else: line = 0 super().__init__( - message, ("program.ws", line + 1, pointer + 1, code), + message, + ("program.ws", line + 1, pointer + 1, code), ) diff --git a/evolution/bank.py b/evolution/bank.py index a382ffa9..89e217c4 100644 --- a/evolution/bank.py +++ b/evolution/bank.py @@ -50,7 +50,7 @@ "BankPruneError", ] -_MAX_BALANCE = 2 ** 63 - 1 +_MAX_BALANCE = 2**63 - 1 _DEFAULT_MEMBER = {"balance": 0, "next_payday": 0} diff --git a/evolution/evolution.py b/evolution/evolution.py index 20fb9413..1a4105b2 100644 --- a/evolution/evolution.py +++ b/evolution/evolution.py @@ -316,7 +316,7 @@ async def shop(self, ctx, start_level: int = None): embed_list = [] for x in range(1, max(list(map(int, animals.keys()))) + 1): embed = discord.Embed( - title=f"{animal.title()} Shop", description=f"Level {str(x)}", color=0xD2B48C, + title=f"{animal.title()} Shop", description=f"Level {str(x)}", color=0xD2B48C ) embed.add_field(name="You currently own", value=animals.get(str(x), 0)) current = int(bought.get(str(x), 0)) @@ -362,7 +362,8 @@ async def daily(self, ctx): Status guide: A: Available to be bought and put in backyard B: Already purchased - S: Available to be bought, but will be put in stash because you either do not have the space for the, or above your level threshold""" + S: Available to be bought, but will be put in stash because you either do not have the space for the, or above your level threshold + """ async with self.lock: data = await self.conf.user(ctx.author).all() animals = data["animals"] diff --git a/evolution/info.json b/evolution/info.json index bef3e7fd..83c0c6c6 100644 --- a/evolution/info.json +++ b/evolution/info.json @@ -1,10 +1,16 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog. This cog requires for the bank to be global in order to be used.", - "name" : "evolution", - "short" : "Buy and get animals to get more economy credits!", - "description" : "Buy animals using economy credits or get them every 10 minutes, and gain a certain amount of credits every minute!", - "tags" : ["fun"], - "requirements" : ["tabulate"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog. This cog requires for the bank to be global in order to be used.", + "name": "evolution", + "short": "Buy and get animals to get more economy credits!", + "description": "Buy animals using economy credits or get them every 10 minutes, and gain a certain amount of credits every minute!", + "tags": [ + "fun" + ], + "requirements": [ + "tabulate" + ], + "hidden": false +} diff --git a/evolution/utils.py b/evolution/utils.py index dc12905d..99707681 100644 --- a/evolution/utils.py +++ b/evolution/utils.py @@ -22,7 +22,7 @@ def get_total_price(level, bought, amount, bt=True): total = 0 for x in range(amount): normal = level * 800 - level_tax = ((2 ** level) * 10) - 200 + level_tax = ((2**level) * 10) - 200 if bt: tax = bought * 300 extra = x * 300 diff --git a/grammar/converters.py b/grammar/converters.py index 96c19006..49d021c9 100644 --- a/grammar/converters.py +++ b/grammar/converters.py @@ -1,4 +1,4 @@ -# Large pieces of the argument parser is taken from Sinbad's cogs. I based mine off of https://github.com/mikeshardmind/SinbadCogs/blob/v3/scheduler/converters.py#L23 +# Large pieces of the argument parser is taken from Sinbad's cogs. I based mine off of https://github.com/mikeshardmind/SinbadCogs/blob/d59fd7bc69833dc24f9e74ec59e635ffe593d43f/scheduler/converters.py#L23 import argparse diff --git a/grammar/info.json b/grammar/info.json index 7ea6a935..6e1fbd41 100644 --- a/grammar/info.json +++ b/grammar/info.json @@ -1,10 +1,12 @@ -{ - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "grammer", - "short" : "Get words related to the specified arguments", - "description" : "Get words related to the specified arguments", - "tags" : [], - "requirements" : [], - "hidden" : false -} \ No newline at end of file +{ + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "grammer", + "short": "Get words related to the specified arguments", + "description": "Get words related to the specified arguments", + "tags": [], + "requirements": [], + "hidden": false +} diff --git a/info.json b/info.json index 2be594cc..16b78100 100644 --- a/info.json +++ b/info.json @@ -1,8 +1,13 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thanks for adding my repo. Join the support server for help:\nhttps://discord.gg/vQZTdB9", - "name" : "Toxic Cogs", - "short" : "Holds cogs made by Neuro Assassin.", - "description" : "This repo holds the several different cogs, for Red - Discord Bot by TwentySix.", - "tags" : ["fun", "tools"] -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thanks for adding my repo. Join the support server for help:\nhttps://discord.gg/vQZTdB9", + "name": "Toxic Cogs", + "short": "Holds cogs made by Neuro Assassin.", + "description": "This repo holds the several different cogs, for Red - Discord Bot by TwentySix.", + "tags": [ + "fun", + "tools" + ] +} diff --git a/listpermissions/info.json b/listpermissions/info.json index 4928221e..5da68bc6 100644 --- a/listpermissions/info.json +++ b/listpermissions/info.json @@ -1,10 +1,17 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "listpermissions", - "short" : "Gives you the permissions of a role/member guild wide or in a channel", - "description" : "This cog will allow you to see all permissions, available permissions or denied permissions or a role or member across the guild or in a channel. Do note however that the `[p](groupcommand) channel role` only provides basic permissions, and will only tell what is different for the channel compared to the guild permissions for a role.", - "tags" : ["tools"], - "requirements" : ["prettytable", "fuzzywuzzy"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "listpermissions", + "short": "Gives you the permissions of a role/member guild wide or in a channel", + "description": "This cog will allow you to see all permissions, available permissions or denied permissions or a role or member across the guild or in a channel. Do note however that the `[p](groupcommand) channel role` only provides basic permissions, and will only tell what is different for the channel compared to the guild permissions for a role.", + "tags": [ + "tools" + ], + "requirements": [ + "prettytable", + "fuzzywuzzy" + ], + "hidden": false +} diff --git a/maintenance/converters.py b/maintenance/converters.py index 75e5b9db..62642ee8 100644 --- a/maintenance/converters.py +++ b/maintenance/converters.py @@ -1,4 +1,4 @@ -# Large pieces of the argument parser is taken from Sinbad's cogs. I based mine off of https://github.com/mikeshardmind/SinbadCogs/blob/v3/scheduler/converters.py#L23 +# Large pieces of the argument parser is taken from Sinbad's cogs. I based mine off of https://github.com/mikeshardmind/SinbadCogs/blob/d59fd7bc69833dc24f9e74ec59e635ffe593d43f/scheduler/converters.py#L23 import argparse import time @@ -38,7 +38,7 @@ async def convert(self, ctx, argument): if start_seconds: if end_seconds: scheduled = ScheduledMaintenance( - start=start_seconds, end=end_seconds, after=after, whitelist=whitelist, + start=start_seconds, end=end_seconds, after=after, whitelist=whitelist ) else: scheduled = ScheduledMaintenance(start=start_seconds, whitelist=whitelist) diff --git a/maintenance/info.json b/maintenance/info.json index e8ee3b7a..ea5a6faf 100644 --- a/maintenance/info.json +++ b/maintenance/info.json @@ -1,9 +1,13 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "maintenance", - "short" : "Allows the bot owner to put the bot on maintenance.", - "description" : "Allows the owner to put the bot on maintenance, and specify when the maintenance will be over (but does not have to). The bot owner can also whitelist users from the maintenance.", - "tags" : ["tools"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "maintenance", + "short": "Allows the bot owner to put the bot on maintenance.", + "description": "Allows the owner to put the bot on maintenance, and specify when the maintenance will be over (but does not have to). The bot owner can also whitelist users from the maintenance.", + "tags": [ + "tools" + ], + "hidden": false +} diff --git a/maintenance/maintenance.py b/maintenance/maintenance.py index 9608bf70..c1594360 100644 --- a/maintenance/maintenance.py +++ b/maintenance/maintenance.py @@ -150,7 +150,8 @@ async def _on(self, ctx, *, args: Margs = None): Examples: `[p]maintenance on --start-in 5 seconds`; starts a maintenance in 5 seconds `[p]maintenance on --start-in 5 seconds --end-in 10 seconds`; starts a maintenance in 5 seconds, then scheduled to end in 10 seconds, so it will only be on maintenance for 5 seconds. - `[p]maintenance on --start-in 10 seconds --end-after 10 seconds --whitelist 473541068378341376 473541068378341377`; starts a maintenance in 10 seconds, that lasts for 10 seconds after, and has the two user IDs who are exempted from the maintenance.""" + `[p]maintenance on --start-in 10 seconds --end-after 10 seconds --whitelist 473541068378341376 473541068378341377`; starts a maintenance in 10 seconds, that lasts for 10 seconds after, and has the two user IDs who are exempted from the maintenance. + """ on = await self.conf.on() if on[0]: return await ctx.send( diff --git a/make.bat b/make.bat index 51127b3a..12d83e65 100644 --- a/make.bat +++ b/make.bat @@ -8,15 +8,15 @@ setlocal ENABLEDELAYEDEXPANSION goto %1 :reformat -black -l 99 . +black . exit /B %ERRORLEVEL% :stylecheck -black --check -l 99 . +black --check . exit /B %ERRORLEVEL% :stylediff -black --check --diff -l 99 . +black --check --diff . exit /B %ERRORLEVEL% :help @@ -25,4 +25,4 @@ echo make ^ echo. echo Commands: echo reformat Reformat all .py files being tracked by git. -echo stylecheck Check which tracked .py files need reformatting. \ No newline at end of file +echo stylecheck Check which tracked .py files need reformatting. diff --git a/minesweeper/info.json b/minesweeper/info.json index 9a352384..b305006d 100644 --- a/minesweeper/info.json +++ b/minesweeper/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.\nSmall warning: this cog can sometimes you up rate limits (depending how fast you play), so be careful while playing.", - "name" : "minesweeper", - "short" : "Allows you to play Minesweeper inside of Discord!\nSmall warning: this cog can sometimes you up rate limits (depending how fast you play), so be careful while playing.", - "description" : "This cog allows a Discord User to play the game Minesweeper inside of a text channel.\nSmall warning: this cog can sometimes you up rate limits (depending how fast you play), so be careful while playing.", - "tags" : ["fun"], - "requirements" : [], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.\nSmall warning: this cog can sometimes you up rate limits (depending how fast you play), so be careful while playing.", + "name": "minesweeper", + "short": "Allows you to play Minesweeper inside of Discord!\nSmall warning: this cog can sometimes you up rate limits (depending how fast you play), so be careful while playing.", + "description": "This cog allows a Discord User to play the game Minesweeper inside of a text channel.\nSmall warning: this cog can sometimes you up rate limits (depending how fast you play), so be careful while playing.", + "tags": [ + "fun" + ], + "requirements": [], + "hidden": false +} diff --git a/minesweeper/minesweeper.py b/minesweeper/minesweeper.py index d21362bf..fb9202b5 100644 --- a/minesweeper/minesweeper.py +++ b/minesweeper/minesweeper.py @@ -341,7 +341,8 @@ def add_desc(self, board): async def minesweeper(self, ctx, bombs: int = "Random bomb amount"): """Starts a game of minesweeper. - You can specify the amount of wanted bombs using the bomb paramater. It must be between 10 bombs and 99 bombs, and defaults to random between 15 to 25.""" + You can specify the amount of wanted bombs using the bomb paramater. It must be between 10 bombs and 99 bombs, and defaults to random between 15 to 25. + """ if isinstance(bombs, str): bombs = random.randint(15, 25) if bombs < 10 or bombs > 99: @@ -422,8 +423,9 @@ def check(m): @commands.command() async def spoilerms(self, ctx, bombs: int = "Random bomb amount"): """Starts a non-interactive game of minesweeper with spoilers. - - You can specify the amount of wanted bombs using the bomb paramater. It must be between 10 bombs and 99 bombs, and defaults to random between 15 to 25.""" + + You can specify the amount of wanted bombs using the bomb paramater. It must be between 10 bombs and 99 bombs, and defaults to random between 15 to 25. + """ if isinstance(bombs, str): bombs = random.randint(15, 25) if bombs < 10 or bombs > 99: diff --git a/opensea/info.json b/opensea/info.json index 85265744..cf6b1eed 100644 --- a/opensea/info.json +++ b/opensea/info.json @@ -11,4 +11,4 @@ ], "requirements": [], "hidden": false -} \ No newline at end of file +} diff --git a/opensea/opensea.py b/opensea/opensea.py index ea4168d5..9b9929b7 100644 --- a/opensea/opensea.py +++ b/opensea/opensea.py @@ -169,7 +169,7 @@ async def publish_update(self, subscribed, event): embed.set_thumbnail(url=event["asset"]["collection"]["image_url"]) embed.add_field(name="Name", value=event["asset"]["name"], inline=True) embed.add_field( - name="Amount", value=str(int(event["total_price"]) / (10 ** 18)) + "Ξ", inline=True + name="Amount", value=str(int(event["total_price"]) / (10**18)) + "Ξ", inline=True ) if event["winner_account"]["user"] and event["winner_account"]["user"]["username"]: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..ad8d0916 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] + line-length = 99 + required-version = '23' diff --git a/reacticket/extensions/base.py b/reacticket/extensions/base.py index d0f81551..70987931 100644 --- a/reacticket/extensions/base.py +++ b/reacticket/extensions/base.py @@ -39,9 +39,7 @@ async def report_close(self, ctx, ticket, author, guild_settings, reason): "mention", "Unknown moderator", ) - embed.add_field( - name="Assigned moderator", value=moderator, - ) + embed.add_field(name="Assigned moderator", value=moderator) await reporting_channel.send(embed=embed) else: diff --git a/reacticket/extensions/mixin.py b/reacticket/extensions/mixin.py index dd78fb5a..9e9f1d4a 100644 --- a/reacticket/extensions/mixin.py +++ b/reacticket/extensions/mixin.py @@ -2,7 +2,8 @@ class RTMixin: - """ This is mostly here to easily mess with things... """ + """This is mostly here to easily mess with things...""" + @checks.bot_has_permissions(add_reactions=True) @commands.guild_only() @commands.group(name="reacticket") @@ -19,7 +20,9 @@ async def settings(self, ctx): channel_id, message_id = list(map(int, guild_settings["msg"].split("-"))) ticket_channel = getattr(self.bot.get_channel(channel_id), "name", "Not set") - ticket_category = getattr(self.bot.get_channel(guild_settings["category"]), "name", "Not set") + ticket_category = getattr( + self.bot.get_channel(guild_settings["category"]), "name", "Not set" + ) archive_category = getattr( self.bot.get_channel(guild_settings["archive"]["category"]), "name", "Not set" ) diff --git a/reacticket/extensions/views/ticket.py b/reacticket/extensions/views/ticket.py index 7bfb791a..fc89540c 100644 --- a/reacticket/extensions/views/ticket.py +++ b/reacticket/extensions/views/ticket.py @@ -79,7 +79,7 @@ async def build_embed(self): self.embed.add_field(name="Ticket Creation Date", value=timestamp, inline=True) @discord.ui.button( - label="Assign Moderator", style=discord.ButtonStyle.primary, emoji="\N{SHIELD}", + label="Assign Moderator", style=discord.ButtonStyle.primary, emoji="\N{SHIELD}" ) async def assign_moderator(self, button: discord.ui.Button, interaction: discord.Interaction): await interaction.response.defer() @@ -358,9 +358,7 @@ def check(message): self.repeat = True self.stop() - @discord.ui.button( - label="Lock Ticket", style=discord.ButtonStyle.danger, emoji="\N{LOCK}", - ) + @discord.ui.button(label="Lock Ticket", style=discord.ButtonStyle.danger, emoji="\N{LOCK}") async def toggle_ticket_lock( self, button: discord.ui.Button, interaction: discord.Interaction ): @@ -396,9 +394,7 @@ async def toggle_ticket_lock( self.ticket["locked"] = not self.ticket["locked"] self.stop() - @discord.ui.button( - label="Archive/Close Ticket", style=discord.ButtonStyle.danger, - ) + @discord.ui.button(label="Archive/Close Ticket", style=discord.ButtonStyle.danger) async def close_ticket(self, button: discord.ui.Button, interaction: discord.Interaction): guild_settings = await self.ctx.cog.config.guild(self.ctx.guild).all() diff --git a/reacticket/info.json b/reacticket/info.json index 84484916..fee5d9f5 100644 --- a/reacticket/info.json +++ b/reacticket/info.json @@ -12,4 +12,4 @@ ], "requirements": [], "hidden": false -} \ No newline at end of file +} diff --git a/reacticket/reacticket.py b/reacticket/reacticket.py index ef93de89..4c39f7bb 100644 --- a/reacticket/reacticket.py +++ b/reacticket/reacticket.py @@ -222,9 +222,7 @@ async def on_member_remove(self, member: discord.Member): ticket["assigned"], "mention", "Unknown moderator" ) ) - embed.add_field( - name="Assigned moderator", value=moderator, - ) + embed.add_field(name="Assigned moderator", value=moderator) await reporting_channel.send(embed=embed) else: message = ( diff --git a/requirements.txt b/requirements.txt index 3cd6f9ec..25318340 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,4 @@ bs4 matplotlib colour prettytable -fuzzywuzzy \ No newline at end of file +fuzzywuzzy diff --git a/scanner/info.json b/scanner/info.json index a2bc3472..41ee0531 100644 --- a/scanner/info.json +++ b/scanner/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog. All settings are disabled by default. Run `[p]scanner settings`.", - "name" : "scanner", - "short" : "Detects images being sent and checks whether they are inappropriate based on the set filters.", - "description" : "This cog will send a report to a channel with details of an image violating the set conditions, and will auto delete the message if set to.", - "tags" : ["tools"], - "requirements" : [], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog. All settings are disabled by default. Run `[p]scanner settings`.", + "name": "scanner", + "short": "Detects images being sent and checks whether they are inappropriate based on the set filters.", + "description": "This cog will send a report to a channel with details of an image violating the set conditions, and will auto delete the message if set to.", + "tags": [ + "tools" + ], + "requirements": [], + "hidden": false +} diff --git a/scanner/scanner.py b/scanner/scanner.py index 61b9126b..71e4e8ba 100644 --- a/scanner/scanner.py +++ b/scanner/scanner.py @@ -414,7 +414,7 @@ async def pingrole(self, ctx, *, role: discord.Role = None): await ctx.send("No roles are set for ping right now.") return e = discord.Embed( - title="The following roles are pinged when a report comes in.", description="", + title="The following roles are pinged when a report comes in.", description="" ) for r in roles: ro = ctx.guild.get_role(r) @@ -594,7 +594,8 @@ async def wad(self, ctx, yes_or_no: bool): async def offensive(self, ctx, yes_or_no: bool): """Set whether or not to check for offensive content in images. - Offensive content includes content such as middle fingers, offensive flags or offensive groups of people.""" + Offensive content includes content such as middle fingers, offensive flags or offensive groups of people. + """ await self.conf.guild(ctx.guild).offensive.set(yes_or_no) if yes_or_no: await ctx.send("Messages will now be reported if they violate the offensive rule.") @@ -637,8 +638,9 @@ async def checks_command(self, ctx): @checks_command.command(name="add") async def checks_add(self, ctx, *checks: str): """Adds checks to the Text Moderation check. - - Must be `sexual`, `insult`, `disciminatory`, `innapropriate`, `other_profanity`, `email`, `ipv4`, `ipv6`, `phone_number_us`, `phone_number_uk`, `phone_number_fr` or `ssn`.""" + + Must be `sexual`, `insult`, `disciminatory`, `innapropriate`, `other_profanity`, `email`, `ipv4`, `ipv6`, `phone_number_us`, `phone_number_uk`, `phone_number_fr` or `ssn`. + """ if not checks: return await ctx.send_help() data = await self.conf.guild(ctx.guild).textmoderation() @@ -723,8 +725,9 @@ async def mm_checks_command(self, ctx): @mm_checks_command.command(name="add") async def mm_checks_add(self, ctx, *checks: str): """Adds checks to the Message Moderation check. - - Must be `sexual`, `insult`, `disciminatory`, `innapropriate`, `other_profanity`, `email`, `ipv4`, `ipv6`, `phone_number_us`, `phone_number_uk`, `phone_number_fr` or `ssn`.""" + + Must be `sexual`, `insult`, `disciminatory`, `innapropriate`, `other_profanity`, `email`, `ipv4`, `ipv6`, `phone_number_us`, `phone_number_uk`, `phone_number_fr` or `ssn`. + """ if not checks: return await ctx.send_help() data = await self.conf.guild(ctx.guild).rawtextmoderation() diff --git a/simon/info.json b/simon/info.json index da938727..e8977ba6 100644 --- a/simon/info.json +++ b/simon/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.\n\n***WARNING***: This cog relies heavily on sending messages, editing emojis and messages and deleting messages. It may use up the bot's rate limits while in use.", - "name" : "simon", - "short" : "Allows you to play Simon inside of Discord!\nWarning! This cog uses a major portion of the bot's rate limits.", - "description" : "This cog allows a Discord User to play the game Simon inside of a text channel.\nWarning! This cog uses a major portion of the bot's rate limits. This may prevent the bot from sending messages, adding emojis or deleting messages in specific peroids of time.", - "tags" : ["fun"], - "requirements" : [], - "hidden" : true -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.\n\n***WARNING***: This cog relies heavily on sending messages, editing emojis and messages and deleting messages. It may use up the bot's rate limits while in use.", + "name": "simon", + "short": "Allows you to play Simon inside of Discord!\nWarning! This cog uses a major portion of the bot's rate limits.", + "description": "This cog allows a Discord User to play the game Simon inside of a text channel.\nWarning! This cog uses a major portion of the bot's rate limits. This may prevent the bot from sending messages, adding emojis or deleting messages in specific peroids of time.", + "tags": [ + "fun" + ], + "requirements": [], + "hidden": true +} diff --git a/simon/simon.py b/simon/simon.py index 56a7aee5..b67b5236 100644 --- a/simon/simon.py +++ b/simon/simon.py @@ -31,9 +31,10 @@ class Simon(commands.Cog): """Play Simon, and guess the write number sequence! - + WARNING: - This cog sends a lot of messages, edits emojis and edits messages. It may use up rate limits heavily.""" + This cog sends a lot of messages, edits emojis and edits messages. It may use up rate limits heavily. + """ def __init__(self, bot): self.bot = bot diff --git a/sw/info.json b/sw/info.json index d5b23066..b53314c6 100644 --- a/sw/info.json +++ b/sw/info.json @@ -1,9 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "sw", - "short" : "Get information about a bunch of different things in Star Wars.", - "description" : "Get information about a bunch of different things in Star Wars.", - "tags" : ["info", "fun"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "sw", + "short": "Get information about a bunch of different things in Star Wars.", + "description": "Get information about a bunch of different things in Star Wars.", + "tags": [ + "info", + "fun" + ], + "hidden": false +} diff --git a/sw/sw.py b/sw/sw.py index 48708e6d..4de833c5 100644 --- a/sw/sw.py +++ b/sw/sw.py @@ -104,7 +104,7 @@ async def person(self, ctx, person_id: Union[int, str]): homeworld = await self.session.get(person["homeworld"]) homeworld = json.loads(await homeworld.text()) embed.add_field( - name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}", + name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}" ) films = [] for film in person["films"]: @@ -119,7 +119,7 @@ async def person(self, ctx, person_id: Union[int, str]): species = await self.session.get(person["species"][0]) species = json.loads(await species.text()) embed.add_field( - name="Species", value=f"Name: {species['name']}; ID: {str(species_num)}", + name="Species", value=f"Name: {species['name']}; ID: {str(species_num)}" ) else: embed.add_field(name="Species", value="Name: Unknown") @@ -150,7 +150,7 @@ async def person(self, ctx, person_id: Union[int, str]): person = json.loads(await response.text()) name = person["results"][0]["name"] embed = discord.Embed( - title=f"Person: {name}", description=HUMANDESCRIPTION[name], color=0x32CD32, + title=f"Person: {name}", description=HUMANDESCRIPTION[name], color=0x32CD32 ) for key, value in person["results"][0].items(): if key in [ @@ -171,7 +171,7 @@ async def person(self, ctx, person_id: Union[int, str]): homeworld = await self.session.get(person["results"][0]["homeworld"]) homeworld = json.loads(await homeworld.text()) embed.add_field( - name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}", + name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}" ) films = [] for film in person["results"][0]["films"]: @@ -186,7 +186,7 @@ async def person(self, ctx, person_id: Union[int, str]): species = await self.session.get(person["species"][0]) species = json.loads(await species.text()) embed.add_field( - name="Species", value=f"Name: {species['name']}; ID: {str(species_num)}", + name="Species", value=f"Name: {species['name']}; ID: {str(species_num)}" ) else: embed.add_field(name="Species", value="Name: Unknown") @@ -265,7 +265,7 @@ async def planet(self, ctx, planet_id: Union[int, str]): planet = json.loads(await response.text()) name = planet["results"][0]["name"] embed = discord.Embed( - title=f"Planet: {name}", description=PLANETDESCRIPTION[name], color=0x800080, + title=f"Planet: {name}", description=PLANETDESCRIPTION[name], color=0x800080 ) for key, value in planet["results"][0].items(): if key in [ @@ -569,7 +569,7 @@ async def vehicle(self, ctx, vehicle_id: Union[int, str]): vehicle = json.loads(await response.text()) name = vehicle["results"][0]["name"] embed = discord.Embed( - title=f"Vehicle: {name}", description=VEHICLEDESCRIPTION[name], color=0x228B22, + title=f"Vehicle: {name}", description=VEHICLEDESCRIPTION[name], color=0x228B22 ) for key, value in vehicle["results"][0].items(): if key in ["name", "films", "edited", "created", "url", "pilots"]: @@ -628,7 +628,7 @@ async def species(self, ctx, species_id: Union[int, str]): homeworld = await self.session.get(species["homeworld"]) homeworld = json.loads(await homeworld.text()) embed.add_field( - name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}", + name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}" ) objects = [] for entry in species["films"]: @@ -657,7 +657,7 @@ async def species(self, ctx, species_id: Union[int, str]): species = json.loads(await response.text()) name = species["results"][0]["name"] embed = discord.Embed( - title=f"Species: {name}", description=SPECIESDESCRIPTION[name], color=0xD2B48C, + title=f"Species: {name}", description=SPECIESDESCRIPTION[name], color=0xD2B48C ) embed.add_field(name="ID:", value=str(species_id)) for key, value in species["results"][0].items(): @@ -677,7 +677,7 @@ async def species(self, ctx, species_id: Union[int, str]): homeworld = await self.session.get(species["results"][0]["homeworld"]) homeworld = json.loads(await homeworld.text()) embed.add_field( - name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}", + name="Homeworld", value=f"Name: {homeworld['name']}; ID: {str(homeworld_num)}" ) objects = [] for entry in species["results"][0]["films"]: diff --git a/targeter/info.json b/targeter/info.json index 2a799454..52b75ce8 100644 --- a/targeter/info.json +++ b/targeter/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "targeter", - "short" : "Targets users based upon the passed arguments", - "description" : "Returns a list of members in the current guild that meet the passed arguments. Commands can take long times based upon the amount of members in the guild.", - "tags" : ["tools"], - "requirements" : [], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "targeter", + "short": "Targets users based upon the passed arguments", + "description": "Returns a list of members in the current guild that meet the passed arguments. Commands can take long times based upon the amount of members in the guild.", + "tags": [ + "tools" + ], + "requirements": [], + "hidden": false +} diff --git a/targeter/targeter.py b/targeter/targeter.py index eee70f5d..a41b3f8f 100644 --- a/targeter/targeter.py +++ b/targeter/targeter.py @@ -69,7 +69,7 @@ "view_audit_log", ] -# Large pieces of the argument parser is taken from Sinbad's cogs. I based mine off of https://github.com/mikeshardmind/SinbadCogs/blob/v3/scheduler/converters.py#L23 +# Large pieces of the argument parser is taken from Sinbad's cogs. I based mine off of https://github.com/mikeshardmind/SinbadCogs/blob/d59fd7bc69833dc24f9e74ec59e635ffe593d43f/scheduler/converters.py#L23 class NoExitParser(argparse.ArgumentParser): @@ -785,7 +785,7 @@ async def target(self, ctx, *, args: Args): return else: embed = discord.Embed( - title="Targeting complete", description=f"Found no matches.", color=0xFF0000, + title="Targeting complete", description=f"Found no matches.", color=0xFF0000 ) m = False if not m: diff --git a/twenty/info.json b/twenty/info.json index cfa2fd14..2a0327e5 100644 --- a/twenty/info.json +++ b/twenty/info.json @@ -1,10 +1,14 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "twenty", - "short" : "Allows you to play 2048 inside of Discord!", - "description" : "This cog allows a Discord User to play 2048 inside of a text channel.", - "tags" : ["fun"], - "requirements" : [], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "twenty", + "short": "Allows you to play 2048 inside of Discord!", + "description": "This cog allows a Discord User to play 2048 inside of a text channel.", + "tags": [ + "fun" + ], + "requirements": [], + "hidden": false +} diff --git a/updatechecker/info.json b/updatechecker/info.json index 977aeb88..5315ca7f 100644 --- a/updatechecker/info.json +++ b/updatechecker/info.json @@ -1,10 +1,16 @@ { - "author" : ["Neuro Assassin"], - "install_msg" : "Thank you for downloading this cog.", - "name" : "updatechecker", - "short" : "Notifies you when an update for a repo is available.", - "description" : "This cog will tell when there is an update available for a repository you have added for your bot, and, depending on settings, will auto update or will just notify you.", - "tags" : ["tools"], - "requirements" : ["feedparser"], - "hidden" : false -} \ No newline at end of file + "author": [ + "Neuro Assassin" + ], + "install_msg": "Thank you for downloading this cog.", + "name": "updatechecker", + "short": "Notifies you when an update for a repo is available.", + "description": "This cog will tell when there is an update available for a repository you have added for your bot, and, depending on settings, will auto update or will just notify you.", + "tags": [ + "tools" + ], + "requirements": [ + "feedparser" + ], + "hidden": false +} diff --git a/updatechecker/updatechecker.py b/updatechecker/updatechecker.py index 0771e909..d369aa39 100644 --- a/updatechecker/updatechecker.py +++ b/updatechecker/updatechecker.py @@ -96,7 +96,9 @@ async def bg_task(self): await self.conf.gochannel.set(0) send = self.bot.send_to_owners else: - use_embed = use_embed and channel.permissions_for(channel.guild.me).embed_links + use_embed = ( + use_embed and channel.permissions_for(channel.guild.me).embed_links + ) send = channel.send else: send = self.bot.send_to_owners @@ -290,7 +292,8 @@ async def channel(self, ctx, channel: discord.TextChannel = None): async def settings(self, ctx): """See settings for the Update Checker cog. - Right now, this shows whether the bot updates cogs automatically and what channel logs are sent to.""" + Right now, this shows whether the bot updates cogs automatically and what channel logs are sent to. + """ auto = await self.conf.auto() channel = await self.conf.gochannel() embed = await self.conf.embed()