Skip to content

Commit 0160d80

Browse files
committed
Updated to match main
1 parent 5c12ac9 commit 0160d80

5 files changed

Lines changed: 10 additions & 4 deletions

File tree

cmd/events/trigger.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ func TriggerCommand() (command *cobra.Command) {
4747
command.Flags().StringVarP(&description, "description", "d", "", "Title the stream should be updated with.")
4848
command.Flags().StringVarP(&gameID, "game-id", "G", "", "Sets the game/category ID for applicable events.")
4949
command.Flags().StringVarP(&tier, "tier", "", "", "Sets the subscription tier. Valid values are 1000, 2000, and 3000.")
50-
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
50+
command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.")
51+
command.Flags().StringVarP(&eventMessageID, "event-id", "I", "", "Manually set the Twitch-Eventsub-Message-Id header value for the event.")
5152
command.Flags().StringVar(&timestamp, "timestamp", "", "Sets the timestamp to be used in payloads and headers. Must be in RFC3339Nano format.")
5253
command.Flags().IntVar(&charityCurrentValue, "charity-current-value", 0, "Only used for \"charity-*\" events. Manually set the current dollar value for charity events.")
5354
command.Flags().IntVar(&charityTargetValue, "charity-target-value", 1500000, "Only used for \"charity-*\" events. Manually set the target dollar value for charity events.")
@@ -94,6 +95,7 @@ func triggerCmdRun(cmd *cobra.Command, args []string) error {
9495
res, err := trigger.Fire(trigger.TriggerParameters{
9596
Event: args[0],
9697
EventID: eventID,
98+
EventMessageID: eventMessageID,
9799
Transport: transport,
98100
ForwardAddress: forwardAddress,
99101
FromUser: fromUser,

cmd/events/variables.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var (
1111
toUser string
1212
giftUser string
1313
eventID string
14+
eventMessageID string
1415
secret string
1516
eventStatus string
1617
subscriptionStatus string

cmd/events/verify_subscription.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ func VerifySubscriptionCommand() (command *cobra.Command) {
3333
command.Flags().StringVarP(&transport, "transport", "T", "webhook", fmt.Sprintf("Preferred transport method for event. Defaults to EventSub.\nSupported values: %s", events.ValidTransports()))
3434
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.")
3535
command.Flags().StringVar(&timestamp, "timestamp", "", "Sets the timestamp to be used in payloads and headers. Must be in RFC3339Nano format.")
36-
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
36+
command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.")
37+
command.Flags().StringVarP(&eventMessageID, "event-id", "I", "", "Manually set the Twitch-Eventsub-Message-Id header value for the event.")
3738
command.Flags().StringVarP(&version, "version", "v", "", "Chooses the EventSub version used for a specific event. Not required for most events.")
3839
command.Flags().BoolVarP(&noConfig, "no-config", "D", false, "Disables the use of the configuration, if it exists.")
3940
command.Flags().StringVarP(&toUser, "broadcaster", "b", "", "User ID of the broadcaster for the verification event.")
@@ -91,6 +92,7 @@ https://dev.twitch.tv/docs/eventsub/handling-webhook-events#processing-an-event`
9192
Secret: secret,
9293
Timestamp: timestamp,
9394
EventID: eventID,
95+
EventMessageID: eventMessageID,
9496
BroadcasterUserID: toUser,
9597
Version: version,
9698
})

internal/events/trigger/retrigger_event.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func RefireEvent(id string, p TriggerParameters) (string, error) {
4848
Secret: p.Secret,
4949
JSON: []byte(res.JSON),
5050
Event: topic,
51+
EventMessageID: "",
5152
Type: EventSubMessageTypeNotification,
5253
SubscriptionVersion: e.SubscriptionVersion(),
5354
})

internal/events/verify/subscription_verify.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func VerifyWebhookSubscription(p VerifyParameters) (VerifyResponse, error) {
5353
}
5454
}
5555

56-
if p.EventID == "" {
57-
p.EventID = util.RandomGUID()
56+
if p.EventMessageID == "" {
57+
p.EventMessageID = util.RandomGUID()
5858
}
5959

6060
if p.BroadcasterUserID == "" {

0 commit comments

Comments
 (0)