Discord.py dep update 3.1 (#2587)

* Dependency update

discord.py==1.0.1
websockets<7

[style]
black==19.3b0

[Docs]
jinja==2.10.1
urllib3==1.24.2

Changes related to breaking changes from discord.py have also been made
to match

As of this commit, help formatter is back to discord.py's default
This commit is contained in:
Michael H
2019-04-23 21:40:38 -04:00
committed by GitHub
parent 0ff7259bc3
commit ad114295e7
83 changed files with 231 additions and 22307 deletions

View File

@@ -8,6 +8,6 @@ async def setup(bot):
# the permissions commands themselves have rules added.
# Automatic listeners being added in add_cog happen in arbitrary
# order, so we want to circumvent that.
bot.add_listener(cog.cog_added, "on_cog_add")
bot.add_listener(cog.command_added, "on_command_add")
bot.add_listener(cog.red_cog_added, "on_cog_add")
bot.add_listener(cog.red_command_added, "on_command_add")
bot.add_cog(cog)

View File

@@ -433,20 +433,26 @@ class Permissions(commands.Cog):
await self._clear_rules(guild_id=ctx.guild.id)
await ctx.tick()
async def cog_added(self, cog: commands.Cog) -> None:
async def red_cog_added(self, cog: commands.Cog) -> None:
"""Event listener for `cog_add`.
This loads rules whenever a new cog is added.
Do not convert to using Cog.listener decorator !!
This *must* be added manually prior to cog load, and removed at unload
"""
self._load_rules_for(
cog_or_command=cog,
rule_dict=await self.config.custom(COG, cog.__class__.__name__).all(),
)
async def command_added(self, command: commands.Command) -> None:
async def red_command_added(self, command: commands.Command) -> None:
"""Event listener for `command_add`.
This loads rules whenever a new command is added.
Do not convert to using Cog.listener decorator !!
This *must* be added manually prior to cog load, and removed at unload
"""
self._load_rules_for(
cog_or_command=command,
@@ -701,9 +707,9 @@ class Permissions(commands.Cog):
elif rule is False:
cog_or_command.deny_to(model_id, guild_id=guild_id)
def __unload(self) -> None:
self.bot.remove_listener(self.cog_added, "on_cog_add")
self.bot.remove_listener(self.command_added, "on_command_add")
def cog_unload(self) -> None:
self.bot.remove_listener(self.red_cog_added, "on_cog_add")
self.bot.remove_listener(self.red_command_added, "on_command_add")
self.bot.loop.create_task(self._unload_all_rules())
async def _unload_all_rules(self) -> None: