Skip to content

Commit 722fea9

Browse files
committed
incorporate fix from Pycord-Development/pycord#2618
1 parent dab3810 commit 722fea9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

jg/coop/lib/discord_task.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ async def on_error(self, event, *args, **kwargs):
4040
logger.debug("Got an error, raising")
4141
raise
4242

43+
async def close(self):
44+
# See https://github.com/Pycord-Development/pycord/pull/2618
45+
if self._closed:
46+
return
47+
await self.http.close()
48+
self._closed = True
49+
for voice in self.voice_clients:
50+
try:
51+
await voice.disconnect(force=True)
52+
except Exception:
53+
pass
54+
if self.ws is not None and self.ws.open:
55+
await self.ws.close(code=1000)
56+
self._ready.clear()
57+
4358
client = Client(loop=asyncio.new_event_loop())
4459

4560
def exc_handler(loop, context):

0 commit comments

Comments
 (0)