Skip to content

Commit

Permalink
incorporate fix from Pycord-Development/pycord#2618
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed Oct 23, 2024
1 parent dab3810 commit 722fea9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions jg/coop/lib/discord_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ async def on_error(self, event, *args, **kwargs):
logger.debug("Got an error, raising")
raise

async def close(self):
# See https://github.com/Pycord-Development/pycord/pull/2618
if self._closed:
return
await self.http.close()
self._closed = True
for voice in self.voice_clients:
try:
await voice.disconnect(force=True)
except Exception:
pass
if self.ws is not None and self.ws.open:
await self.ws.close(code=1000)
self._ready.clear()

client = Client(loop=asyncio.new_event_loop())

def exc_handler(loop, context):
Expand Down

0 comments on commit 722fea9

Please sign in to comment.