Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dpy2.0 avatar fixes #206

Open
wants to merge 14 commits into
base: dpy2.0
Choose a base branch
from
Prev Previous commit
Next Next commit
say: use async cog_unload
  • Loading branch information
laggron42 committed Aug 18, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 49022b502f21e6b57a8218740798ee6ea2ba1f8c
11 changes: 2 additions & 9 deletions say/say.py
Original file line number Diff line number Diff line change
@@ -319,10 +319,6 @@ async def slash_say(
guild = interaction.guild
channel = channel or interaction.channel

if not guild:
await interaction.response.send_message(_("This command cannot be used in DM."))
return

if not message and not file:
await interaction.response.send_message(
_("You cannot send an empty message."), ephemeral=True
@@ -378,11 +374,8 @@ async def stop_interaction(self, user):
self.interaction.remove(user)
await user.send(_("Session closed"))

def __unload(self):
self.cog_unload()

def cog_unload(self):
async def cog_unload(self):
log.debug("Unloading cog...")
for user in self.interaction:
self.bot.loop.create_task(self.stop_interaction(user))
await self.stop_interaction(user)
close_logger(log)