diff options
-rw-r--r-- | Pipfile | 2 | ||||
-rw-r--r-- | Pipfile.lock | 48 | ||||
-rw-r--r-- | azure-pipelines.yml | 2 | ||||
-rw-r--r-- | bot/cogs/bot.py | 2 | ||||
-rw-r--r-- | bot/cogs/snekbox.py | 6 | ||||
-rw-r--r-- | bot/cogs/utils.py | 3 | ||||
-rw-r--r-- | bot/constants.py | 6 | ||||
-rw-r--r-- | config-default.yml | 5 |
8 files changed, 56 insertions, 18 deletions
@@ -22,7 +22,7 @@ urllib3 = ">=1.24.2,<1.25" [dev-packages] flake8 = "~=3.7" -flake8-annotations = "~=1.0" +flake8-annotations = "~=1.1" flake8-bugbear = "~=19.8" flake8-docstrings = "~=1.4" flake8-import-order = "~=0.18" diff --git a/Pipfile.lock b/Pipfile.lock index 58489c60e..4e6b4eaf8 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "6c2d9ea980f1dbe954237de6d173ffa9ba480aa5cf0a03c4d7840b0739d4e2fa" + "sha256": "c2537cc3c5b0886d0b38f9b48f4f4b93e1e74d925454aa71a2189bddedadde42" }, "pipfile-spec": 6, "requires": { @@ -150,6 +150,13 @@ ], "version": "==3.0.4" }, + "colorama": { + "hashes": [ + "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", + "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48" + ], + "version": "==0.4.1" + }, "deepdiff": { "hashes": [ "sha256:1123762580af0904621136d117c8397392a244d3ff0fa0a50de57a7939582476", @@ -447,10 +454,10 @@ }, "soupsieve": { "hashes": [ - "sha256:8662843366b8d8779dec4e2f921bebec9afd856a5ff2e82cd419acc5054a1a92", - "sha256:a5a6166b4767725fd52ae55fee8c8b6137d9a51e9f1edea461a062a759160118" + "sha256:605f89ad5fdbfefe30cdc293303665eff2d188865d4dbe4eb510bba1edfbfce3", + "sha256:b91d676b330a0ebd5b21719cb6e9b57c57d433671f65b9c28dd3461d9a1ed0b6" ], - "version": "==1.9.3" + "version": "==1.9.4" }, "sphinx": { "hashes": [ @@ -603,6 +610,13 @@ ], "version": "==7.0" }, + "colorama": { + "hashes": [ + "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", + "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48" + ], + "version": "==0.4.1" + }, "coverage": { "hashes": [ "sha256:08907593569fe59baca0bf152c43f3863201efb6113ecb38ce7e97ce339805a6", @@ -671,11 +685,11 @@ }, "flake8-annotations": { "hashes": [ - "sha256:1309f2bc9853a2d77d578b089d331b0b832b40c97932641e136e1b49d3650c82", - "sha256:3ecdd27054c3eed6484139025698465e3c9f4e68dbd5043d0204fcb2550ee27b" + "sha256:6ac7ca1e706307686b60af8043ff1db31dc2cfc1233c8210d67a3d9b8f364736", + "sha256:b51131007000d67217608fa028a35ff80aa400b474e5972f1f99c2cf9d26bd2e" ], "index": "pypi", - "version": "==1.0.0" + "version": "==1.1.0" }, "flake8-bugbear": { "hashes": [ @@ -895,6 +909,26 @@ ], "version": "==0.10.0" }, + "typed-ast": { + "hashes": [ + "sha256:18511a0b3e7922276346bcb47e2ef9f38fb90fd31cb9223eed42c85d1312344e", + "sha256:262c247a82d005e43b5b7f69aff746370538e176131c32dda9cb0f324d27141e", + "sha256:2b907eb046d049bcd9892e3076c7a6456c93a25bebfe554e931620c90e6a25b0", + "sha256:354c16e5babd09f5cb0ee000d54cfa38401d8b8891eefa878ac772f827181a3c", + "sha256:4e0b70c6fc4d010f8107726af5fd37921b666f5b31d9331f0bd24ad9a088e631", + "sha256:630968c5cdee51a11c05a30453f8cd65e0cc1d2ad0d9192819df9978984529f4", + "sha256:66480f95b8167c9c5c5c87f32cf437d585937970f3fc24386f313a4c97b44e34", + "sha256:71211d26ffd12d63a83e079ff258ac9d56a1376a25bc80b1cdcdf601b855b90b", + "sha256:95bd11af7eafc16e829af2d3df510cecfd4387f6453355188342c3e79a2ec87a", + "sha256:bc6c7d3fa1325a0c6613512a093bc2a2a15aeec350451cbdf9e1d4bffe3e3233", + "sha256:cc34a6f5b426748a507dd5d1de4c1978f2eb5626d51326e43280941206c209e1", + "sha256:d755f03c1e4a51e9b24d899561fec4ccaf51f210d52abdf8c07ee2849b212a36", + "sha256:d7c45933b1bdfaf9f36c579671fec15d25b06c8398f113dab64c18ed1adda01d", + "sha256:d896919306dd0aa22d0132f62a1b78d11aaf4c9fc5b3410d3c666b818191630a", + "sha256:ffde2fbfad571af120fcbfbbc61c72469e72f550d676c3342492a9dfdefb8f12" + ], + "version": "==1.4.0" + }, "urllib3": { "hashes": [ "sha256:2393a695cd12afedd0dcb26fe5d50d0cf248e5a66f75dbd89a3d4eb333a61af4", diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b5ecab83c..c22bac089 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -50,7 +50,7 @@ jobs: - job: build displayName: 'Build & Push Container' dependsOn: 'test' - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) steps: - task: Docker@2 diff --git a/bot/cogs/bot.py b/bot/cogs/bot.py index 324d2ccd3..7583b2f2d 100644 --- a/bot/cogs/bot.py +++ b/bot/cogs/bot.py @@ -153,7 +153,7 @@ class Bot(Cog): def fix_indentation(self, msg: str) -> str: """Attempts to fix badly indented code.""" - def unindent(code, skip_spaces: int = 0) -> str: + def unindent(code: str, skip_spaces: int = 0) -> str: """Unindents all code down to the number of spaces given in skip_spaces.""" final = "" current = code[0] diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py index 5accbdb5e..81185cf3e 100644 --- a/bot/cogs/snekbox.py +++ b/bot/cogs/snekbox.py @@ -7,11 +7,10 @@ from typing import Optional, Tuple from discord.ext.commands import Bot, Cog, Context, command, guild_only -from bot.constants import Channels, STAFF_ROLES, URLs +from bot.constants import Channels, Roles, URLs from bot.decorators import in_channel from bot.utils.messages import wait_for_deletion - log = logging.getLogger(__name__) ESCAPE_REGEX = re.compile("[`\u202E\u200B]{3,}") @@ -34,6 +33,7 @@ RAW_CODE_REGEX = re.compile( ) MAX_PASTE_LEN = 1000 +EVAL_ROLES = (Roles.helpers, Roles.moderator, Roles.admin, Roles.owner, Roles.rockstars, Roles.partners) class Snekbox(Cog): @@ -166,7 +166,7 @@ class Snekbox(Cog): @command(name="eval", aliases=("e",)) @guild_only() - @in_channel(Channels.bot, bypass_roles=STAFF_ROLES) + @in_channel(Channels.bot, bypass_roles=EVAL_ROLES) async def eval_command(self, ctx: Context, *, code: str = None) -> None: """ Run Python code and get the results. diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index 62e2fb03f..b6cecdc7c 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -3,6 +3,7 @@ import re import unicodedata from email.parser import HeaderParser from io import StringIO +from typing import Tuple from discord import Colour, Embed from discord.ext.commands import Bot, Cog, Context, command @@ -106,7 +107,7 @@ class Utils(Cog): await ctx.send(embed=embed) return - def get_info(char): + def get_info(char: str) -> Tuple[str, str]: digit = f"{ord(char):x}" if len(digit) <= 4: u_code = f"\\u{digit:>04}" diff --git a/bot/constants.py b/bot/constants.py index e1c47889c..1deeaa3b8 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -375,13 +375,15 @@ class Roles(metaclass=YAMLGetter): champion: int contributor: int core_developer: int + helpers: int jammer: int moderator: int muted: int owner: int - verified: int # This is the Developers role on PyDis, here named verified for readability reasons. - helpers: int + partners: int + rockstars: int team_leader: int + verified: int # This is the Developers role on PyDis, here named verified for readability reasons. class Guild(metaclass=YAMLGetter): diff --git a/config-default.yml b/config-default.yml index 403de21ad..38b26f64f 100644 --- a/config-default.yml +++ b/config-default.yml @@ -128,14 +128,15 @@ guild: champion: 430492892331769857 contributor: 295488872404484098 core_developer: 587606783669829632 + helpers: 267630620367257601 jammer: 423054537079783434 moderator: &MOD_ROLE 267629731250176001 muted: &MUTED_ROLE 277914926603829249 owner: &OWNER_ROLE 267627879762755584 - verified: 352427296948486144 - helpers: 267630620367257601 + partners: 323426753857191936 rockstars: &ROCKSTARS_ROLE 458226413825294336 team_leader: 501324292341104650 + verified: 352427296948486144 webhooks: talent_pool: 569145364800602132 |