Advertisement
Guest User

dekorator

a guest
Oct 20th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1.     def event(self, func):
  2.         async def wrapper():
  3.             while True:
  4.                 event = await self.ws.recv()
  5.                 event = json.loads(event)
  6.                 if event['t'] == func.__name__:
  7.                     func(event)
  8.  
  9.         asyncio.get_event_loop().run_until_complete(wrapper())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement