diff options
Diffstat (limited to '')
| -rw-r--r-- | Pipfile | 1 | ||||
| -rw-r--r-- | Pipfile.lock | 28 | ||||
| -rw-r--r-- | bot/exts/evergreen/profile_pic_modification/pfp_modify.py | 16 | 
3 files changed, 16 insertions, 29 deletions
| @@ -15,7 +15,6 @@ PyYAML = "~=5.3.1"  "discord.py" = {extras = ["voice"], version = "~=1.5.1"}  async-rediscache = {extras = ["fakeredis"], version = "~=0.1.4"}  emojis = "~=0.6.0" -aiofiles = "~=0.6"  [dev-packages]  flake8 = "~=3.8" diff --git a/Pipfile.lock b/Pipfile.lock index 9d0a988e..19bcb719 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@  {      "_meta": {          "hash": { -            "sha256": "91281e9ed353fea748de3da19abd7bef402402b23fc78a1260dc8bf8bd2bd98c" +            "sha256": "b4aaaacbab13179145e36d7b86c736db512286f6cce8e513cc30c48d68fe3810"          },          "pipfile-spec": 6,          "requires": { @@ -24,14 +24,6 @@              "index": "pypi",              "version": "==2.0.0"          }, -        "aiofiles": { -            "hashes": [ -                "sha256:bd3019af67f83b739f8e4053c6c0512a7f545b9a8d91aaeab55e6e0f9d123c27", -                "sha256:e0281b157d3d5d59d803e3f4557dcc9a3dff28a4dd4829a9ff478adae50ca092" -            ], -            "index": "pypi", -            "version": "==0.6.0" -        },          "aiohttp": {              "hashes": [                  "sha256:1a4160579ffbc1b69e88cb6ca8bb0fbd4947dfcbf9fb1e2a4fc4c7a4a986c1fe", @@ -531,11 +523,11 @@          },          "flake8-annotations": {              "hashes": [ -                "sha256:3a377140556aecf11fa9f3bb18c10db01f5ea56dc79a730e2ec9b4f1f49e2055", -                "sha256:e17947a48a5b9f632fe0c72682fc797c385e451048e7dfb20139f448a074cb3e" +                "sha256:8968ff12f296433028ad561c680ccc03a7cd62576d100c3f1475e058b3c11b43", +                "sha256:bd0505616c0d85ebb45c6052d339c69f320d3f87fa079ab4e91a4f234a863d05"              ],              "index": "pypi", -            "version": "==2.5.0" +            "version": "==2.6.0"          },          "flake8-bugbear": {              "hashes": [ @@ -593,11 +585,11 @@          },          "identify": {              "hashes": [ -                "sha256:2179e7359471ab55729f201b3fdf7dc2778e221f868410fedcb0987b791ba552", -                "sha256:2a5fdf2f5319cc357eda2550bea713a404392495961022cf2462624ce62f0f46" +                "sha256:e3b7fd755b7ceee44fe22957005a92c2a085c863c2e65a6efdec35d0e06666db", +                "sha256:fab0d3a3ab0d7d5f513985b0335ccccad9d61420c5216fb779237bf7edc3e5d1"              ],              "markers": "python_full_version >= '3.6.1'", -            "version": "==2.1.0" +            "version": "==2.1.2"          },          "mccabe": {              "hashes": [ @@ -623,11 +615,11 @@          },          "pre-commit": {              "hashes": [ -                "sha256:16212d1fde2bed88159287da88ff03796863854b04dc9f838a55979325a3d20e", -                "sha256:399baf78f13f4de82a29b649afd74bef2c4e28eb4f021661fc7f29246e8c7a3a" +                "sha256:94c82f1bf5899d56edb1d926732f4e75a7df29a0c8c092559c77420c9d62428b", +                "sha256:de55c5c72ce80d79106e48beb1b54104d16495ce7f95b0c7b13d4784193a00af"              ],              "index": "pypi", -            "version": "==2.10.1" +            "version": "==2.11.1"          },          "pycodestyle": {              "hashes": [ diff --git a/bot/exts/evergreen/profile_pic_modification/pfp_modify.py b/bot/exts/evergreen/profile_pic_modification/pfp_modify.py index b13ba574..d41fcaad 100644 --- a/bot/exts/evergreen/profile_pic_modification/pfp_modify.py +++ b/bot/exts/evergreen/profile_pic_modification/pfp_modify.py @@ -4,7 +4,6 @@ import logging  import typing as t  from concurrent.futures import ThreadPoolExecutor -import aiofiles  import discord  from aiohttp import client_exceptions  from discord.ext import commands @@ -21,6 +20,9 @@ _EXECUTOR = ThreadPoolExecutor(10)  FILENAME_STRING = "{effect}_{author}.png" +with open('bot/resources/pride/gender_options.json') as f: +    GENDER_OPTIONS = json.loads(f.read()) +  async def in_executor(func: t.Callable, *args) -> t.Any:      """Allows non-async functions to work in async functions.""" @@ -34,12 +36,6 @@ class PfpModify(commands.Cog):      def __init__(self, bot: commands.Bot) -> None:          self.bot = bot -        self.bot.loop.create_task(self.init_cog()) - -    async def init_cog(self) -> None: -        """Initial load from resources asynchronously.""" -        async with aiofiles.open('bot/resources/pride/gender_options.json') as f: -            self.GENDER_OPTIONS = json.loads(await f.read())      @commands.group()      async def pfp_modify(self, ctx: commands.Context) -> None: @@ -176,7 +172,7 @@ class PfpModify(commands.Cog):          """          option = option.lower()          pixels = max(0, min(512, pixels)) -        flag = self.GENDER_OPTIONS.get(option) +        flag = GENDER_OPTIONS.get(option)          if flag is None:              await ctx.send("I don't have that flag!")              return @@ -197,7 +193,7 @@ class PfpModify(commands.Cog):          """          option = option.lower()          pixels = max(0, min(512, pixels)) -        flag = self.GENDER_OPTIONS.get(option) +        flag = GENDER_OPTIONS.get(option)          if flag is None:              await ctx.send("I don't have that flag!")              return @@ -221,7 +217,7 @@ class PfpModify(commands.Cog):      @prideavatar.command()      async def flags(self, ctx: commands.Context) -> None:          """This lists the flags that can be used with the prideavatar command.""" -        choices = sorted(set(self.GENDER_OPTIONS.values())) +        choices = sorted(set(GENDER_OPTIONS.values()))          options = "• " + "\n• ".join(choices)          embed = discord.Embed(              title="I have the following flags:", | 
