Skip to content

Commit

Permalink
Merge pull request #233 from TheUntraceable/patch-1
Browse files Browse the repository at this point in the history
Fix 'AioClient.on_event' was never awaited
  • Loading branch information
NikOverflow authored Mar 30, 2024
2 parents 3af12f1 + d29e99f commit 5b4cb5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pypresence/client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import inspect
import struct
import json
Expand Down Expand Up @@ -225,7 +226,7 @@ async def unregister_event(self, event: str, args=None):
del self._events[event]

# noinspection PyProtectedMember
async def on_event(self, data):
def on_event(self, data):
if self.sock_reader._eof:
raise PyPresenceException('feed_data after feed_eof')
if not data:
Expand All @@ -247,7 +248,7 @@ async def on_event(self, data):
if payload["evt"] is not None:
evt = payload["evt"].lower()
if evt in self._events:
await self._events[evt](payload["data"])
asyncio.create_task(self._events[evt](payload["data"]))
elif evt == 'error':
raise DiscordError(payload["data"]["code"], payload["data"]["message"])

Expand Down

0 comments on commit 5b4cb5a

Please sign in to comment.