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

Commit a6a94d6

Browse files
committed
make it handle duplicate events
make it handle duplicate events (same id) coming from streamlabs for any event type, rather than just duplicate donations like before.
1 parent 2c9b0b6 commit a6a94d6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Source/Streamlabs Rcon Integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self):
1919
self.config.LogMissingSettings()
2020

2121
def Setup(self):
22-
self.donationsIdsProcessed = {}
22+
self.eventIdsProcessed = {}
2323
self.mysterySubGifts = {}
2424
self.translations = Translations(self)
2525
self.currency = Currency(self)
@@ -153,7 +153,7 @@ def OnStreamlabsEventHandler(self, data):
153153
actionType = "Rcon command"
154154
try:
155155
self.logging.DebugLog(
156-
"Doing Rcon command: " + actionText)
156+
"Doing Rcon command: " + actionText)
157157
response = self.rcon.SendCommand(actionText)
158158
except Exception as ex:
159159
self.logging.RecordException(ex, "Rcon event failed")

Source/StreamlabsEvent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, state, platformString, typeString, payload):
4444

4545
self.handlerName = StreamlabsEventUtils.MakeHandlerString(
4646
self.platform, self.type)
47+
self.state.eventIdsProcessed[self.id] = True
4748

4849
@property
4950
def value(self):
@@ -91,11 +92,11 @@ def ShouldIgnoreEvent(self):
9192
elif self.state.profiles.currentProfile.options.twitchMysterSubGiftMode == "donator" and self.type == "subscriptionGift":
9293
gifterName = self.rawMessage["gifter_display_name"]
9394
if gifterName in self.state.mysterySubGifts and self.state.mysterySubGifts[gifterName] > 0:
94-
self.state.mysterySubGifts[gifterName]-=1
95+
self.state.mysterySubGifts[gifterName] -= 1
9596
return True
96-
if self.id in self.state.donationsIdsProcessed:
97+
if self.id in self.state.eventIdsProcessed:
9798
self.logging.DebugLog(
98-
"Streamlabs donation event being ignored as in processed list: " + self.id)
99+
"Event being ignored as in processed list: " + self.id)
99100
return True
100101
return False
101102

@@ -104,7 +105,6 @@ def PopulateNormalisedData(self):
104105
self.valueType = "money"
105106
self.value = self.state.currency.GetNormalisedValue(
106107
self.rawMessage["currency"], float(self.rawMessage["amount"]))
107-
self.state.donationsIdsProcessed[self.id] = True
108108
elif (self.handlerName == "patreon-pledge"):
109109
self.valueType = "money"
110110
self.value = self.state.currency.GetNormalisedValue(

0 commit comments

Comments
 (0)