Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit 34c5b67

Browse files
committed
add patreon pledge event type
1 parent dc89da7 commit 34c5b67

File tree

6 files changed

+47
-4
lines changed

6 files changed

+47
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Streamlabs-Rcon-Integration
22

33

4-
A Python exe for integrating Streamlabs and any game supporting Rcon. Its currently being used with Factorio, but should be compatible with any other Rcon interfaced game.
4+
A Python exe for integrating Streamlabs and any game supporting Rcon. Its currently being used with Factorio, but should be compatible with any other Rcon interfaced game.
55

66
At present only really tested with Twitch, but should work with mixer and youtube based on API spec.
77

@@ -18,6 +18,8 @@ Installation & Usage
1818

1919
Should a critical error occur the program may fail to load or close. Details can be found in the most recent log file within the Logs folder.
2020

21+
Note: on clicking `Start` the program checks the RCON connection. If a Factorio server has been paused by a player then the RCON command will never respond and the application will freeze. Make sure that Factorio hasn't been paused by a player when clicking to `Start`. A server with 0 players on is not in this state.
22+
2123

2224
Program Execution Concepts
2325
========

Source/StreamlabsEvent.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ def PopulateNormalisedData(self):
116116
self.value = self.state.currency.GetNormalisedValue(
117117
self.rawMessage["currency"], float(self.rawMessage["amount"]))
118118
self.state.donationsIdsProcessed[self.id] = True
119+
elif (self.handlerName == "patreon-pledge"):
120+
self.valueType = "money"
121+
self.value = self.state.currency.GetNormalisedValue(
122+
self.rawMessage["currency"], float(self.rawMessage["amount"]))
119123
elif (self.handlerName == "youtube_account-superchat"):
120124
self.valueType = "money"
121125
self.value = self.state.currency.GetNormalisedValue(

Source/eventDefinitions.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"VALUE": {
2020
"valueType": "number",
21-
"description": "the standardised value of the event. Donations and money amounts are converted to USD. Subscriptions have the USD cost of them. Follows and Hosts have the viewer count. This may be a decimal number"
21+
"description": "the standardised value of the event. Donations and money amounts are converted to USD with 2 decimal digits for cents if needed. Subscriptions have the USD cost of them. Follows and Hosts have the viewer count."
2222
},
2323
"MODVALUE": {
2424
"valueType": "number",
@@ -55,6 +55,24 @@
5555
"description": "the 3 letter currance code, i.e. USD, GBP"
5656
}
5757
},
58+
"patreon-pledge": {
59+
"name": {
60+
"valueType": "text string",
61+
"description": "the username of the person who did the event"
62+
},
63+
"formatted_amount": {
64+
"valueType": "text string",
65+
"description": "the amount as 2 decimal places and the currancy symbol"
66+
},
67+
"amount": {
68+
"valueType": "number",
69+
"description": "the amount of the donation with a variable (0-10) number of decimal places"
70+
},
71+
"currency": {
72+
"valueType": "text string",
73+
"description": "the 3 letter currance code, i.e. USD, GBP"
74+
}
75+
},
5876
"twitch_account-subscription": {
5977
"name": {
6078
"valueType": "text string",

ToDo.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,20 @@ Make a profile manager GUI
33
Make so that profile startup errors are shown in a GUI and disable running until fixed.
44
Have seperate Activity and System (status, warning, errors) logs
55
Have a way to pause logs from updating and then resume
6-
Add a way to fire test events data at this to allow better testing of responses than the Streamlabs Test Widgets button.
6+
Add a way to fire test events data at this to allow better testing of responses than the Streamlabs Test Widgets button.
7+
8+
9+
10+
11+
the integration handles gifted subs for the recipient of the sub, but knowing its been gifted by someone.
12+
that's probably something to add to the integration list to be able to handle gifted subs as single donation from the gifter.
13+
14+
add option for getting gift subscriptions from the gifter view and not from the receiver view
15+
16+
can have multiple payloads per event. need to split these up to separate events internally.
17+
18+
Support multiple rcon commands as an array in JSON.
19+
20+
Support multiple calculated values via exec. Array in exec, to numbered strings in action script.
21+
22+
change modvalue to calcvalue

event samples.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ TWITCH REAL WORLD
2828

2929
22:43:07 : Streamlabs supported raw event received: {'type': 'raid', 'message': [{'id': 'a7ca29ca-03c8-4857-b9d4-915fa03fc275', 'name': 'user', 'display_name': 'UsEr', 'raiders': '28', '_id': 'a7ca29ca-03c8-4857-b9d4-915fa03fc275', 'event_id': 'a7ca29ca-03c8-4857-b9d4-915fa03fc275'}], 'for': 'twitch_account'}
3030

31-
19:37:29 : Streamlabs raw event data: {'type': 'pledge', 'message': [{'name': 'UsEr', 'isTest': True, 'formatted_amount': '£56.00', 'amount': 56, 'currency': 'GBP', 'to': {'name': 'StReAmErNaMe'}, 'from': 'Real Name', '_id': '938e6fdb71d5b11a19d170c3dbca555c'}], 'for': 'patreon', 'event_id': 'evt_a5f4b15b617c16d498f8fdf6d0865aaa'}
31+
19:37:29 : Streamlabs raw event data: {'type': 'pledge', 'message': [{'name': 'UsEr', 'isTest': True, 'formatted_amount': '£56.00', 'amount': 56, 'currency': 'GBP', 'to': {'name': 'StReAmErNaMe'}, 'from': 'Real Name', '_id': '938e6fdb71d5b11a19d170c3dbca555c'}], 'for': 'patreon', 'event_id': 'evt_a5f4b15b617c16d498f8fdf6d0865aaa'}
32+
33+
multiple payload entries per event (any of them potentially):
34+
00:00:14 : Streamlabs event errored during initial handling: {id: '', platform: 'twitch_account', type: 'follow', errored: 'True', ignored: 'False', handlerName: '', valueType: '', value: '0.0', bestName: '', rawData: {'type': 'follow', 'message': [{'created_at': '2019-06-12 23:00:00', 'id': '12345678', 'name': 'UsEr1', '_id': '34ba6c0ce4412ccacf965ae4042076fa', 'event_id': '34ba6c0ce4412ccacf965ae4042076fa'}, {'created_at': '2019-06-12 22:59:56', 'id': '56789056789', 'name': 'UsEr2', '_id': '1f1ebd9a598f64fad10875baefb89f5b', 'event_id': '1f1ebd9a598f64fad10875baefb89f5b'}], 'for': 'twitch_account'}}
File renamed without changes.

0 commit comments

Comments
 (0)