Skip to content

Commit 32c971c

Browse files
committed
Update to 1.1.1
1 parent 6aed072 commit 32c971c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setuptools.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.",

simpleobsws.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import inspect
1313
import enum
1414
from dataclasses import dataclass
15+
from inspect import signature
1516

1617
RPC_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))

0 commit comments

Comments
 (0)