Skip to content

Commit

Permalink
Merge pull request #77 from greebowarrior/main
Browse files Browse the repository at this point in the history
Fix for incorrect Hypetrain EventSub data
  • Loading branch information
lleadbet authored Jul 22, 2021
2 parents 18e417a + 4cb8e8a commit 3388f14
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/events/types/hype_train/hype_train_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (e Event) GenerateEvent(params events.MockEventParameters) (events.MockEven
lastType := util.RandomType()

//Local variables which will be used for the trigger params below
localLevel := util.RandomInt(4) + 1
localTotal := util.RandomInt(10 * 100)
localGoal := util.RandomInt(10*100*100) + localTotal
localProgress := (localTotal / localGoal)
Expand Down Expand Up @@ -92,11 +93,20 @@ func (e Event) GenerateEvent(params events.MockEventParameters) (events.MockEven
UserLoginWhoMadeContribution: "cli_user2",
},
StartedAtTimestamp: util.GetTimestamp().Format(time.RFC3339Nano),
ExpiresAtTimestamp: util.GetTimestamp().Format(time.RFC3339Nano),
ExpiresAtTimestamp: util.GetTimestamp().Add(5 * time.Minute).Format(time.RFC3339Nano),
},
}
if triggerMapping[params.Transport][params.Trigger] == "hype-train-end " {
if params.Trigger == "hype-train-progress" {
body.Event.Level = localLevel
}
if params.Trigger == "hype-train-end" {
body.Event.CooldownEndsAtTimestamp = util.GetTimestamp().Add(1 * time.Hour).Format(time.RFC3339Nano)
body.Event.EndedAtTimestamp = util.GetTimestamp().Format(time.RFC3339Nano)
body.Event.ExpiresAtTimestamp = ""
body.Event.Goal = 0
body.Event.Level = localLevel
body.Event.Progress = 0
body.Event.StartedAtTimestamp = util.GetTimestamp().Add(5 * -time.Minute).Format(time.RFC3339Nano)
}
event, err = json.Marshal(body)
if err != nil {
Expand Down

0 comments on commit 3388f14

Please sign in to comment.