Skip to content

Commit

Permalink
Updated to match main
Browse files Browse the repository at this point in the history
  • Loading branch information
Xemdo committed Jun 18, 2024
1 parent 5c12ac9 commit 0160d80
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion cmd/events/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ func TriggerCommand() (command *cobra.Command) {
command.Flags().StringVarP(&description, "description", "d", "", "Title the stream should be updated with.")
command.Flags().StringVarP(&gameID, "game-id", "G", "", "Sets the game/category ID for applicable events.")
command.Flags().StringVarP(&tier, "tier", "", "", "Sets the subscription tier. Valid values are 1000, 2000, and 3000.")
command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.") // TODO: This description will need to change with https://github.com/twitchdev/twitch-cli/issues/184
command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.")
command.Flags().StringVarP(&eventMessageID, "event-id", "I", "", "Manually set the Twitch-Eventsub-Message-Id header value for the event.")
command.Flags().StringVar(&timestamp, "timestamp", "", "Sets the timestamp to be used in payloads and headers. Must be in RFC3339Nano format.")
command.Flags().IntVar(&charityCurrentValue, "charity-current-value", 0, "Only used for \"charity-*\" events. Manually set the current dollar value for charity events.")
command.Flags().IntVar(&charityTargetValue, "charity-target-value", 1500000, "Only used for \"charity-*\" events. Manually set the target dollar value for charity events.")
Expand Down Expand Up @@ -94,6 +95,7 @@ func triggerCmdRun(cmd *cobra.Command, args []string) error {
res, err := trigger.Fire(trigger.TriggerParameters{
Event: args[0],
EventID: eventID,
EventMessageID: eventMessageID,
Transport: transport,
ForwardAddress: forwardAddress,
FromUser: fromUser,
Expand Down
1 change: 1 addition & 0 deletions cmd/events/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var (
toUser string
giftUser string
eventID string
eventMessageID string
secret string
eventStatus string
subscriptionStatus string
Expand Down
4 changes: 3 additions & 1 deletion cmd/events/verify_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func VerifySubscriptionCommand() (command *cobra.Command) {
command.Flags().StringVarP(&transport, "transport", "T", "webhook", fmt.Sprintf("Preferred transport method for event. Defaults to EventSub.\nSupported values: %s", events.ValidTransports()))
command.Flags().StringVarP(&secret, "secret", "s", "", "Webhook secret. If defined, signs all forwarded events with the SHA256 HMAC and must be 10-100 characters in length.")
command.Flags().StringVar(&timestamp, "timestamp", "", "Sets the timestamp to be used in payloads and headers. Must be in RFC3339Nano format.")
command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.") // TODO: This description will need to change with https://github.com/twitchdev/twitch-cli/issues/184
command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.")
command.Flags().StringVarP(&eventMessageID, "event-id", "I", "", "Manually set the Twitch-Eventsub-Message-Id header value for the event.")
command.Flags().StringVarP(&version, "version", "v", "", "Chooses the EventSub version used for a specific event. Not required for most events.")
command.Flags().BoolVarP(&noConfig, "no-config", "D", false, "Disables the use of the configuration, if it exists.")
command.Flags().StringVarP(&toUser, "broadcaster", "b", "", "User ID of the broadcaster for the verification event.")
Expand Down Expand Up @@ -91,6 +92,7 @@ https://dev.twitch.tv/docs/eventsub/handling-webhook-events#processing-an-event`
Secret: secret,
Timestamp: timestamp,
EventID: eventID,
EventMessageID: eventMessageID,
BroadcasterUserID: toUser,
Version: version,
})
Expand Down
1 change: 1 addition & 0 deletions internal/events/trigger/retrigger_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func RefireEvent(id string, p TriggerParameters) (string, error) {
Secret: p.Secret,
JSON: []byte(res.JSON),
Event: topic,
EventMessageID: "",
Type: EventSubMessageTypeNotification,
SubscriptionVersion: e.SubscriptionVersion(),
})
Expand Down
4 changes: 2 additions & 2 deletions internal/events/verify/subscription_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func VerifyWebhookSubscription(p VerifyParameters) (VerifyResponse, error) {
}
}

if p.EventID == "" {
p.EventID = util.RandomGUID()
if p.EventMessageID == "" {
p.EventMessageID = util.RandomGUID()
}

if p.BroadcasterUserID == "" {
Expand Down

0 comments on commit 0160d80

Please sign in to comment.