From 8f264487991daaf6f917f54eaf4e2bdb97b38ce5 Mon Sep 17 00:00:00 2001 From: Amber Bertucci Date: Fri, 7 Oct 2022 06:47:22 +0000 Subject: [PATCH 1/2] Make all setup functions async This is required with the new modmail release --- ban_appeals/ban_appeals.py | 2 +- close_message/close_message.py | 2 +- mdlink/mdlink.py | 2 +- ping_manager/ping_manager.py | 2 +- reply_cooldown/reply_cooldown.py | 2 +- tagging/tagging.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ban_appeals/ban_appeals.py b/ban_appeals/ban_appeals.py index 4a1d74b..7acff95 100644 --- a/ban_appeals/ban_appeals.py +++ b/ban_appeals/ban_appeals.py @@ -234,6 +234,6 @@ async def on_member_remove(self, member: discord.Member) -> None: await thread.channel.send(embed=embed) -def setup(bot: ModmailBot) -> None: +async def setup(bot: ModmailBot) -> None: """Add the BanAppeals cog.""" bot.add_cog(BanAppeals(bot)) diff --git a/close_message/close_message.py b/close_message/close_message.py index 8ccf079..0c30f3e 100644 --- a/close_message/close_message.py +++ b/close_message/close_message.py @@ -105,6 +105,6 @@ async def message(self, ctx: commands.Context) -> None: await ctx.send(f'> {DEFAULT_CLOSE_MESSAGE}') -def setup(bot: ModmailBot) -> None: +async def setup(bot: ModmailBot) -> None: """Load the CloseMessage plugin.""" bot.add_cog(CloseMessage(bot)) diff --git a/mdlink/mdlink.py b/mdlink/mdlink.py index 2145567..e215007 100644 --- a/mdlink/mdlink.py +++ b/mdlink/mdlink.py @@ -20,6 +20,6 @@ async def mdlink(self, ctx: commands.Context, *, text: str = "ModMail") -> None: await ctx.send(f"`[{text}]({link})`") -def setup(bot: ModmailBot) -> None: +async def setup(bot: ModmailBot) -> None: """Add the MDLink plugin.""" bot.add_cog(MDLink(bot)) diff --git a/ping_manager/ping_manager.py b/ping_manager/ping_manager.py index d125bf6..7e761ca 100644 --- a/ping_manager/ping_manager.py +++ b/ping_manager/ping_manager.py @@ -298,6 +298,6 @@ async def on_thread_ready(self, thread: Thread, *args) -> None: await self.add_ping_task(ping_task) -def setup(bot: ModmailBot) -> None: +async def setup(bot: ModmailBot) -> None: """Add the PingManager plugin.""" bot.add_cog(PingManager(bot)) diff --git a/reply_cooldown/reply_cooldown.py b/reply_cooldown/reply_cooldown.py index 80e9086..b4cf512 100644 --- a/reply_cooldown/reply_cooldown.py +++ b/reply_cooldown/reply_cooldown.py @@ -16,7 +16,7 @@ COOLDOWN_TIME = 10 -def setup(bot: ModmailBot) -> None: +async def setup(bot: ModmailBot) -> None: """Monkey patch the built-in reply function to add a cooldown between uses.""" _reply = Thread.reply diff --git a/tagging/tagging.py b/tagging/tagging.py index 32b6883..a07e6a4 100644 --- a/tagging/tagging.py +++ b/tagging/tagging.py @@ -36,6 +36,6 @@ async def tag(self, ctx: commands.Context, *, tag: Optional[str]) -> None: await ctx.message.add_reaction("\u2705") -def setup(bot: ModmailBot) -> None: +async def setup(bot: ModmailBot) -> None: """Add the Tagging plugin.""" bot.add_cog(Tagging(bot)) From e429022094b11cabecb02f3ce0b02f4f98d8a7de Mon Sep 17 00:00:00 2001 From: Amber Bertucci Date: Fri, 7 Oct 2022 06:52:27 +0000 Subject: [PATCH 2/2] Make sure to await bot.add_cog --- ban_appeals/ban_appeals.py | 2 +- close_message/close_message.py | 2 +- mdlink/mdlink.py | 2 +- ping_manager/ping_manager.py | 2 +- tagging/tagging.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ban_appeals/ban_appeals.py b/ban_appeals/ban_appeals.py index 7acff95..cd76f25 100644 --- a/ban_appeals/ban_appeals.py +++ b/ban_appeals/ban_appeals.py @@ -236,4 +236,4 @@ async def on_member_remove(self, member: discord.Member) -> None: async def setup(bot: ModmailBot) -> None: """Add the BanAppeals cog.""" - bot.add_cog(BanAppeals(bot)) + await bot.add_cog(BanAppeals(bot)) diff --git a/close_message/close_message.py b/close_message/close_message.py index 0c30f3e..1d60553 100644 --- a/close_message/close_message.py +++ b/close_message/close_message.py @@ -107,4 +107,4 @@ async def message(self, ctx: commands.Context) -> None: async def setup(bot: ModmailBot) -> None: """Load the CloseMessage plugin.""" - bot.add_cog(CloseMessage(bot)) + await bot.add_cog(CloseMessage(bot)) diff --git a/mdlink/mdlink.py b/mdlink/mdlink.py index e215007..bd6b5e1 100644 --- a/mdlink/mdlink.py +++ b/mdlink/mdlink.py @@ -22,4 +22,4 @@ async def mdlink(self, ctx: commands.Context, *, text: str = "ModMail") -> None: async def setup(bot: ModmailBot) -> None: """Add the MDLink plugin.""" - bot.add_cog(MDLink(bot)) + await bot.add_cog(MDLink(bot)) diff --git a/ping_manager/ping_manager.py b/ping_manager/ping_manager.py index 7e761ca..989eb79 100644 --- a/ping_manager/ping_manager.py +++ b/ping_manager/ping_manager.py @@ -300,4 +300,4 @@ async def on_thread_ready(self, thread: Thread, *args) -> None: async def setup(bot: ModmailBot) -> None: """Add the PingManager plugin.""" - bot.add_cog(PingManager(bot)) + await bot.add_cog(PingManager(bot)) diff --git a/tagging/tagging.py b/tagging/tagging.py index a07e6a4..7f10aeb 100644 --- a/tagging/tagging.py +++ b/tagging/tagging.py @@ -38,4 +38,4 @@ async def tag(self, ctx: commands.Context, *, tag: Optional[str]) -> None: async def setup(bot: ModmailBot) -> None: """Add the Tagging plugin.""" - bot.add_cog(Tagging(bot)) + await bot.add_cog(Tagging(bot))