File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 77
88setuptools .setup (
99 name = "simpleobsws" ,
10- version = "1.1.0 " ,
10+ version = "1.1.1 " ,
1111 author = "tt2468" ,
1212 author_email = "tt2468@gmail.com" ,
1313 description = "A simple obs-websocket library in async Python for people who just want JSON output." ,
Original file line number Diff line number Diff line change 1212import inspect
1313import enum
1414from dataclasses import dataclass
15+ from inspect import signature
1516
1617RPC_VERSION = 1
1718
@@ -266,13 +267,19 @@ async def _ws_recv_task(self):
266267 elif op_code == 5 : # Event
267268 for callback , trigger in self .event_callbacks :
268269 if trigger == None :
269- self .loop .create_task (callback (data_payload ['eventType' ], data_payload .get ('eventData' )))
270+ params = len (signature (callback ).parameters )
271+ if params == 1 :
272+ self .loop .create_task (callback (data_payload ))
273+ elif params == 2 :
274+ self .loop .create_task (callback (data_payload ['eventType' ], data_payload .get ('eventData' )))
275+ elif params == 3 :
276+ self .loop .create_task (callback (data_payload ['eventType' ], data_payload .get ('eventIntent' ), data_payload .get ('eventData' )))
270277 elif trigger == data_payload ['eventType' ]:
271278 self .loop .create_task (callback (data_payload .get ('eventData' )))
272279 elif op_code == 0 : # Hello
273280 self .hello_message = data_payload
274281 await self ._send_identify (self .password , self .identification_parameters )
275- elif op_code == 3 : # Identified
282+ elif op_code == 2 : # Identified
276283 self .identified = True
277284 else :
278285 log .warning ('Unknown OpCode: {}' .format (op_code ))
You can’t perform that action at this time.
0 commit comments