@overlaysymphony/twitch 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/package.json +2 -2
  2. package/src/authentication/authentication.ts +1 -1
  3. package/src/authentication/index.ts +1 -1
  4. package/src/chat/chat.ts +4 -4
  5. package/src/chat/helpers.ts +1 -1
  6. package/src/chat/index.ts +4 -3
  7. package/src/chat/interfaces/index.ts +2 -2
  8. package/src/chat/parser.ts +1 -1
  9. package/src/eventsub/events/automod.message.hold-2.ts +81 -0
  10. package/src/eventsub/events/automod.message.update-2.ts +94 -0
  11. package/src/eventsub/events/automod.settings.update-1.ts +65 -0
  12. package/src/eventsub/events/automod.terms.update-1.ts +59 -0
  13. package/src/eventsub/events/channel.ad_break.begin-1.ts +50 -0
  14. package/src/eventsub/events/channel.ban-1.ts +58 -0
  15. package/src/eventsub/events/channel.bits.use-1.ts +112 -0
  16. package/src/eventsub/events/channel.channel_points_automatic_reward_redemption.add-2.ts +88 -0
  17. package/src/eventsub/events/channel.channel_points_custom_reward.add-1.ts +101 -0
  18. package/src/eventsub/events/channel.channel_points_custom_reward.remove-1.ts +103 -0
  19. package/src/eventsub/events/channel.channel_points_custom_reward.update-1.ts +103 -0
  20. package/src/eventsub/events/channel.channel_points_custom_reward_redemption.add-1.ts +65 -0
  21. package/src/eventsub/events/channel.channel_points_custom_reward_redemption.update-1.ts +65 -0
  22. package/src/eventsub/events/channel.charity_campaign.donate-1.ts +69 -0
  23. package/src/eventsub/events/channel.charity_campaign.progress-1.ts +74 -0
  24. package/src/eventsub/events/channel.charity_campaign.start-1.ts +76 -0
  25. package/src/eventsub/events/channel.charity_campaign.stop-1.ts +76 -0
  26. package/src/eventsub/events/channel.chat.clear-1.ts +41 -0
  27. package/src/eventsub/events/channel.chat.clear_user_messages-1.ts +47 -0
  28. package/src/eventsub/events/channel.chat.message-1.ts +160 -0
  29. package/src/eventsub/events/channel.chat.message_delete-1.ts +49 -0
  30. package/src/eventsub/events/channel.chat.notification-1.ts +317 -0
  31. package/src/eventsub/events/channel.chat.user_message_hold-1.ts +75 -0
  32. package/src/eventsub/events/channel.chat.user_message_update-1.ts +82 -0
  33. package/src/eventsub/events/channel.chat_settings.update-1.ts +83 -0
  34. package/src/eventsub/events/channel.cheer-1.ts +50 -0
  35. package/src/eventsub/events/channel.follow-2.ts +49 -0
  36. package/src/eventsub/events/channel.goal.begin-1.ts +80 -0
  37. package/src/eventsub/events/channel.goal.end-1.ts +80 -0
  38. package/src/eventsub/events/channel.goal.progress-1.ts +80 -0
  39. package/src/eventsub/events/channel.guest_star_guest.update-beta.ts +85 -0
  40. package/src/eventsub/events/channel.guest_star_session.begin-beta.ts +50 -0
  41. package/src/eventsub/events/channel.guest_star_session.end-beta.ts +58 -0
  42. package/src/eventsub/events/channel.guest_star_settings.update-beta.ts +62 -0
  43. package/src/eventsub/events/channel.hype_train.begin-2.ts +90 -0
  44. package/src/eventsub/events/channel.hype_train.end-2.ts +70 -0
  45. package/src/eventsub/events/channel.hype_train.progress-2.ts +90 -0
  46. package/src/eventsub/events/channel.moderate-2.ts +258 -0
  47. package/src/eventsub/events/channel.moderator.add-1.ts +44 -0
  48. package/src/eventsub/events/channel.moderator.remove-1.ts +44 -0
  49. package/src/eventsub/events/channel.poll.begin-1.ts +73 -0
  50. package/src/eventsub/events/channel.poll.end-1.ts +75 -0
  51. package/src/eventsub/events/channel.poll.progress-1.ts +73 -0
  52. package/src/eventsub/events/channel.prediction.begin-1.ts +72 -0
  53. package/src/eventsub/events/channel.prediction.end-1.ts +76 -0
  54. package/src/eventsub/events/channel.prediction.lock-1.ts +72 -0
  55. package/src/eventsub/events/channel.prediction.progress-1.ts +72 -0
  56. package/src/eventsub/events/channel.raid-1.ts +48 -0
  57. package/src/eventsub/events/channel.shared_chat.begin-1.ts +55 -0
  58. package/src/eventsub/events/channel.shared_chat.end-1.ts +46 -0
  59. package/src/eventsub/events/channel.shared_chat.update-1.ts +55 -0
  60. package/src/eventsub/events/channel.shield_mode.begin-1.ts +51 -0
  61. package/src/eventsub/events/channel.shield_mode.end-1.ts +51 -0
  62. package/src/eventsub/events/channel.shoutout.create-1.ts +61 -0
  63. package/src/eventsub/events/channel.shoutout.receive-1.ts +51 -0
  64. package/src/eventsub/events/channel.subscribe-1.ts +48 -0
  65. package/src/eventsub/events/channel.subscription.end-1.ts +48 -0
  66. package/src/eventsub/events/channel.subscription.gift-1.ts +52 -0
  67. package/src/eventsub/events/channel.subscription.message-1.ts +66 -0
  68. package/src/eventsub/events/channel.suspicious_user.message-1.ts +85 -0
  69. package/src/eventsub/events/channel.suspicious_user.update-1.ts +55 -0
  70. package/src/eventsub/events/channel.unban-1.ts +50 -0
  71. package/src/eventsub/events/channel.unban_request.create-1.ts +53 -0
  72. package/src/eventsub/events/channel.unban_request.resolve-1.ts +64 -0
  73. package/src/eventsub/events/channel.update-2.ts +48 -0
  74. package/src/eventsub/events/channel.vip.add-1.ts +44 -0
  75. package/src/eventsub/events/channel.vip.remove-1.ts +44 -0
  76. package/src/eventsub/events/channel.warning.acknowledge-1.ts +47 -0
  77. package/src/eventsub/events/channel.warning.send-1.ts +57 -0
  78. package/src/eventsub/events/index.ts +73 -284
  79. package/src/eventsub/events/stream.offline-1.ts +38 -0
  80. package/src/eventsub/events/stream.online-1.ts +44 -0
  81. package/src/eventsub/events/user.update-1.ts +48 -0
  82. package/src/eventsub/events/user.whisper.message-1.ts +51 -0
  83. package/src/eventsub/events-helpers.ts +53 -25
  84. package/src/eventsub/eventsub.ts +37 -74
  85. package/src/eventsub/index.ts +8 -6
  86. package/src/eventsub/messages.ts +16 -4
  87. package/src/helix/channel-points/custom-rewards.ts +3 -3
  88. package/src/helix/channel-points/index.ts +1 -1
  89. package/src/helix/helix.ts +1 -1
  90. package/src/helix/subscriptions/index.ts +1 -1
  91. package/src/helix/subscriptions/subscriptions.ts +40 -47
  92. package/src/helix/users/index.ts +1 -1
  93. package/src/helix/users/users.ts +3 -3
  94. package/src/helpers/alerts/alerts.ts +5 -5
  95. package/src/helpers/alerts/index.ts +2 -2
  96. package/src/helpers/charity/charity.ts +2 -2
  97. package/src/helpers/charity/index.ts +1 -1
  98. package/src/helpers/goal/goal.ts +2 -2
  99. package/src/helpers/goal/index.ts +1 -1
  100. package/src/helpers/hype-train/hype-train.ts +2 -2
  101. package/src/helpers/hype-train/index.ts +1 -1
  102. package/src/helpers/poll/index.ts +1 -1
  103. package/src/helpers/poll/poll.ts +3 -3
  104. package/src/helpers/prediction/index.ts +1 -1
  105. package/src/helpers/prediction/prediction.ts +3 -3
  106. package/src/helpers/redemption/index.ts +1 -1
  107. package/src/helpers/redemption/redemption.ts +3 -3
  108. package/src/helpers/status/index.ts +1 -1
  109. package/src/helpers/status/status.ts +2 -2
  110. package/src/ui/authentication.ts +1 -1
  111. package/src/ui/popup.ts +26 -3
  112. package/src/eventsub/events/channel.ad_break.begin.ts +0 -51
  113. package/src/eventsub/events/channel.ban.ts +0 -59
  114. package/src/eventsub/events/channel.channel_points_custom_reward._.ts +0 -29
  115. package/src/eventsub/events/channel.channel_points_custom_reward.add.ts +0 -75
  116. package/src/eventsub/events/channel.channel_points_custom_reward.remove.ts +0 -77
  117. package/src/eventsub/events/channel.channel_points_custom_reward.update.ts +0 -77
  118. package/src/eventsub/events/channel.channel_points_custom_reward_redemption._.ts +0 -10
  119. package/src/eventsub/events/channel.channel_points_custom_reward_redemption.add.ts +0 -59
  120. package/src/eventsub/events/channel.channel_points_custom_reward_redemption.update.ts +0 -59
  121. package/src/eventsub/events/channel.charity_campaign.donate.ts +0 -66
  122. package/src/eventsub/events/channel.charity_campaign.progress.ts +0 -67
  123. package/src/eventsub/events/channel.charity_campaign.start.ts +0 -69
  124. package/src/eventsub/events/channel.charity_campaign.stop.ts +0 -69
  125. package/src/eventsub/events/channel.chat.clear.ts +0 -42
  126. package/src/eventsub/events/channel.chat.clear_user_messages.ts +0 -48
  127. package/src/eventsub/events/channel.chat.message_delete.ts +0 -50
  128. package/src/eventsub/events/channel.chat.notification.ts +0 -50
  129. package/src/eventsub/events/channel.cheer.ts +0 -51
  130. package/src/eventsub/events/channel.follow.ts +0 -50
  131. package/src/eventsub/events/channel.goal.begin.ts +0 -51
  132. package/src/eventsub/events/channel.goal.end.ts +0 -55
  133. package/src/eventsub/events/channel.goal.progress.ts +0 -51
  134. package/src/eventsub/events/channel.guest_star_guest.update.ts +0 -66
  135. package/src/eventsub/events/channel.guest_star_session.begin.ts +0 -46
  136. package/src/eventsub/events/channel.guest_star_session.end.ts +0 -48
  137. package/src/eventsub/events/channel.guest_star_settings.update.ts +0 -50
  138. package/src/eventsub/events/channel.hype_train._.ts +0 -12
  139. package/src/eventsub/events/channel.hype_train.begin.ts +0 -57
  140. package/src/eventsub/events/channel.hype_train.end.ts +0 -55
  141. package/src/eventsub/events/channel.hype_train.progress.ts +0 -70
  142. package/src/eventsub/events/channel.moderator.add.ts +0 -45
  143. package/src/eventsub/events/channel.moderator.remove.ts +0 -45
  144. package/src/eventsub/events/channel.poll._.ts +0 -26
  145. package/src/eventsub/events/channel.poll.begin.ts +0 -55
  146. package/src/eventsub/events/channel.poll.end.ts +0 -57
  147. package/src/eventsub/events/channel.poll.progress.ts +0 -55
  148. package/src/eventsub/events/channel.prediction._.ts +0 -25
  149. package/src/eventsub/events/channel.prediction.begin.ts +0 -51
  150. package/src/eventsub/events/channel.prediction.end.ts +0 -55
  151. package/src/eventsub/events/channel.prediction.lock.ts +0 -51
  152. package/src/eventsub/events/channel.prediction.progress.ts +0 -51
  153. package/src/eventsub/events/channel.raid.ts +0 -49
  154. package/src/eventsub/events/channel.shield_mode.begin.ts +0 -50
  155. package/src/eventsub/events/channel.shield_mode.end.ts +0 -50
  156. package/src/eventsub/events/channel.shoutout.create.ts +0 -62
  157. package/src/eventsub/events/channel.shoutout.receive.ts +0 -52
  158. package/src/eventsub/events/channel.subscribe.ts +0 -49
  159. package/src/eventsub/events/channel.subscription.end.ts +0 -49
  160. package/src/eventsub/events/channel.subscription.gift.ts +0 -53
  161. package/src/eventsub/events/channel.subscription.message.ts +0 -67
  162. package/src/eventsub/events/channel.unban.ts +0 -51
  163. package/src/eventsub/events/channel.update.ts +0 -49
  164. package/src/eventsub/events/stream.offline.ts +0 -39
  165. package/src/eventsub/events/stream.online.ts +0 -45
  166. package/src/eventsub/events/user.update.ts +0 -45
@@ -0,0 +1,44 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "channel.vip.remove": ChannelVipRemove
6
+ }
7
+ }
8
+
9
+ /** Channel Vip Remove v1: When a VIP is removed from the channel. */
10
+ type ChannelVipRemove = EventConfig<{
11
+ Type: "channel.vip.remove"
12
+ Version: "1"
13
+ /** The conditions to listen for when a VIP is removed from the channel. */
14
+ Condition: {
15
+ /** The User ID of the broadcaster (channel) Maximum: 1 */
16
+ broadcaster_user_id: string
17
+ }
18
+ /** The event fired when a VIP is removed from the channel. */
19
+ Event: {
20
+ /** The ID of the user who was removed as a VIP. */
21
+ user_id: string
22
+ /** The login of the user who was removed as a VIP. */
23
+ user_login: string
24
+ /** The display name of the user who was removed as a VIP. */
25
+ user_name: string
26
+ /** The ID of the broadcaster. */
27
+ broadcaster_user_id: string
28
+ /** The login of the broadcaster. */
29
+ broadcaster_user_login: string
30
+ /** The display name of the broadcaster. */
31
+ broadcaster_user_name: string
32
+ }
33
+ }>
34
+
35
+ registerEvent("channel.vip.remove", {
36
+ scopes: ["channel:manage:vips", "channel:read:vips"],
37
+ subscriber: (userId) => ({
38
+ type: "channel.vip.remove",
39
+ version: "1",
40
+ condition: {
41
+ broadcaster_user_id: userId,
42
+ },
43
+ }),
44
+ })
@@ -0,0 +1,47 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "channel.warning.acknowledge": ChannelWarningAcknowledge
6
+ }
7
+ }
8
+
9
+ /** Channel Warning Acknowledge v1: When a user awknowledges a warning. Broadcasters and moderators can see the warning's details. */
10
+ type ChannelWarningAcknowledge = EventConfig<{
11
+ Type: "channel.warning.acknowledge"
12
+ Version: "1"
13
+ /** The conditions to listen for when a user awknowledges a warning. Broadcasters and moderators can see the warning's details. */
14
+ Condition: {
15
+ /** The User ID of the broadcaster. */
16
+ broadcaster_user_id: string
17
+ /** The User ID of the moderator. */
18
+ moderator_user_id: string
19
+ }
20
+ /** The event fired when a user awknowledges a warning. Broadcasters and moderators can see the warning's details. */
21
+ Event: {
22
+ /** The user ID of the broadcaster. */
23
+ broadcaster_user_id: string
24
+ /** The login of the broadcaster. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster. */
27
+ broadcaster_user_name: string
28
+ /** The ID of the user that has acknowledged their warning. */
29
+ user_id: string
30
+ /** The login of the user that has acknowledged their warning. */
31
+ user_login: string
32
+ /** The user name of the user that has acknowledged their warning. */
33
+ user_name: string
34
+ }
35
+ }>
36
+
37
+ registerEvent("channel.warning.acknowledge", {
38
+ scopes: ["moderator:manage:warnings", "moderator:read:warnings"],
39
+ subscriber: (userId) => ({
40
+ type: "channel.warning.acknowledge",
41
+ version: "1",
42
+ condition: {
43
+ broadcaster_user_id: userId,
44
+ moderator_user_id: userId,
45
+ },
46
+ }),
47
+ })
@@ -0,0 +1,57 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "channel.warning.send": ChannelWarningSend
6
+ }
7
+ }
8
+
9
+ /** Channel Warning Send v1: When a user is sent a warning. Broadcasters and moderators can see the warning's details. */
10
+ type ChannelWarningSend = EventConfig<{
11
+ Type: "channel.warning.send"
12
+ Version: "1"
13
+ /** The conditions to listen for when a user is sent a warning. Broadcasters and moderators can see the warning's details. */
14
+ Condition: {
15
+ /** The User ID of the broadcaster. */
16
+ broadcaster_user_id: string
17
+ /** The User ID of the moderator. */
18
+ moderator_user_id: string
19
+ }
20
+ /** The event fired when a user is sent a warning. Broadcasters and moderators can see the warning's details. */
21
+ Event: {
22
+ /** The user ID of the broadcaster. */
23
+ broadcaster_user_id: string
24
+ /** The login of the broadcaster. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster. */
27
+ broadcaster_user_name: string
28
+ /** The user ID of the moderator who sent the warning. */
29
+ moderator_user_id: string
30
+ /** The login of the moderator. */
31
+ moderator_user_login: string
32
+ /** The user name of the moderator. */
33
+ moderator_user_name: string
34
+ /** The ID of the user being warned. */
35
+ user_id: string
36
+ /** The login of the user being warned. */
37
+ user_login: string
38
+ /** The user name of the user being. */
39
+ user_name: string
40
+ /** The reason given for the warning. */
41
+ reason?: string
42
+ /** The chat rules cited for the warning. */
43
+ chat_rules_cited?: string[]
44
+ }
45
+ }>
46
+
47
+ registerEvent("channel.warning.send", {
48
+ scopes: ["moderator:manage:warnings", "moderator:read:warnings"],
49
+ subscriber: (userId) => ({
50
+ type: "channel.warning.send",
51
+ version: "1",
52
+ condition: {
53
+ broadcaster_user_id: userId,
54
+ moderator_user_id: userId,
55
+ },
56
+ }),
57
+ })
@@ -1,284 +1,73 @@
1
- import { type NotificationMessage } from "../events-helpers.js"
2
-
3
- import { type ChannelAdBreakBeginEvent, type ChannelAdBreakBeginSubscription, makeChannelAdBreakBeginSubscription } from "./channel.ad_break.begin.js"
4
- import { type ChannelBanEvent, type ChannelBanSubscription, makeChannelBanSubscription } from "./channel.ban.js"
5
- import { type ChannelPointsCustomRewardAddEvent, type ChannelPointsCustomRewardAddSubscription, makeChannelPointsCustomRewardAddSubscription } from "./channel.channel_points_custom_reward.add.js"
6
- import { type ChannelPointsCustomRewardRemoveEvent, type ChannelPointsCustomRewardRemoveSubscription, makeChannelPointsCustomRewardRemoveSubscription } from "./channel.channel_points_custom_reward.remove.js"
7
- import { type ChannelPointsCustomRewardUpdateEvent, type ChannelPointsCustomRewardUpdateSubscription, makeChannelPointsCustomRewardUpdateSubscription } from "./channel.channel_points_custom_reward.update.js"
8
- import { type ChannelPointsCustomRewardRedemptionAddEvent, type ChannelPointsCustomRewardRedemptionAddSubscription, makeChannelPointsCustomRewardRedemptionAddSubscription } from "./channel.channel_points_custom_reward_redemption.add.js"
9
- import { type ChannelPointsCustomRewardRedemptionUpdateEvent, type ChannelPointsCustomRewardRedemptionUpdateSubscription, makeChannelPointsCustomRewardRedemptionUpdateSubscription } from "./channel.channel_points_custom_reward_redemption.update.js"
10
- import { type CharityDonationEvent, type CharityDonationSubscription, makeCharityDonationSubscription } from "./channel.charity_campaign.donate.js"
11
- import { type CharityCampaignProgressEvent, type CharityCampaignProgressSubscription, makeCharityCampaignProgressSubscription } from "./channel.charity_campaign.progress.js"
12
- import { type CharityCampaignStartEvent, type CharityCampaignStartSubscription, makeCharityCampaignStartSubscription } from "./channel.charity_campaign.start.js"
13
- import { type CharityCampaignStopEvent, type CharityCampaignStopSubscription, makeCharityCampaignStopSubscription } from "./channel.charity_campaign.stop.js"
14
- import { type ChannelChatClearEvent, type ChannelChatClearSubscription, makeChannelChatClearSubscription } from "./channel.chat.clear.js"
15
- import { type ChannelChatClearUserMessagesEvent, type ChannelChatClearUserMessagesSubscription, makeChannelChatClearUserMessagesSubscription } from "./channel.chat.clear_user_messages.js"
16
- import { type ChannelChatMessageDeleteEvent, type ChannelChatMessageDeleteSubscription, makeChannelChatMessageDeleteSubscription } from "./channel.chat.message_delete.js"
17
- import { type ChannelChatNotificationEvent, type ChannelChatNotificationSubscription, makeChannelChatNotificationSubscription } from "./channel.chat.notification.js"
18
- import { type ChannelCheerEvent, type ChannelCheerSubscription, makeChannelCheerSubscription } from "./channel.cheer.js"
19
- import { type ChannelFollowEvent, type ChannelFollowSubscription, makeChannelFollowSubscription } from "./channel.follow.js"
20
- import { type GoalBeginEvent, type GoalBeginSubscription, makeGoalBeginSubscription } from "./channel.goal.begin.js"
21
- import { type GoalEndEvent, type GoalEndSubscription, makeGoalEndSubscription } from "./channel.goal.end.js"
22
- import { type GoalProgressEvent, type GoalProgressSubscription, makeGoalProgressSubscription } from "./channel.goal.progress.js"
23
- import { type ChannelGuestStarGuestUpdateEvent, type ChannelGuestStarGuestUpdateSubscription, makeChannelGuestStarGuestUpdateSubscription } from "./channel.guest_star_guest.update.js"
24
- import { type ChannelGuestStarSessionBeginEvent, type ChannelGuestStarSessionBeginSubscription, makeChannelGuestStarSessionBeginSubscription } from "./channel.guest_star_session.begin.js"
25
- import { type ChannelGuestStarSessionEndEvent, type ChannelGuestStarSessionEndSubscription, makeChannelGuestStarSessionEndSubscription } from "./channel.guest_star_session.end.js"
26
- import { type ChannelGuestStarSettingsUpdateEvent, type ChannelGuestStarSettingsUpdateSubscription, makeChannelGuestStarSettingsUpdateSubscription } from "./channel.guest_star_settings.update.js"
27
- import { type HypeTrainBeginEvent, type HypeTrainBeginSubscription, makeHypeTrainBeginSubscription } from "./channel.hype_train.begin.js"
28
- import { type HypeTrainEndEvent, type HypeTrainEndSubscription, makeHypeTrainEndSubscription } from "./channel.hype_train.end.js"
29
- import { type HypeTrainProgressEvent, type HypeTrainProgressSubscription, makeHypeTrainProgressSubscription } from "./channel.hype_train.progress.js"
30
- import { type ChannelModeratorAddEvent, type ChannelModeratorAddSubscription, makeChannelModeratorAddSubscription } from "./channel.moderator.add.js"
31
- import { type ChannelModeratorRemoveEvent, type ChannelModeratorRemoveSubscription, makeChannelModeratorRemoveSubscription } from "./channel.moderator.remove.js"
32
- import { type ChannelPollBeginEvent, type ChannelPollBeginSubscription, makeChannelPollBeginSubscription } from "./channel.poll.begin.js"
33
- import { type ChannelPollEndEvent, type ChannelPollEndSubscription, makeChannelPollEndSubscription } from "./channel.poll.end.js"
34
- import { type ChannelPollProgressEvent, type ChannelPollProgressSubscription, makeChannelPollProgressSubscription } from "./channel.poll.progress.js"
35
- import { type ChannelPredictionBeginEvent, type ChannelPredictionBeginSubscription, makeChannelPredictionBeginSubscription } from "./channel.prediction.begin.js"
36
- import { type ChannelPredictionEndEvent, type ChannelPredictionEndSubscription, makeChannelPredictionEndSubscription } from "./channel.prediction.end.js"
37
- import { type ChannelPredictionLockEvent, type ChannelPredictionLockSubscription, makeChannelPredictionLockSubscription } from "./channel.prediction.lock.js"
38
- import { type ChannelPredictionProgressEvent, type ChannelPredictionProgressSubscription, makeChannelPredictionProgressSubscription } from "./channel.prediction.progress.js"
39
- import { type ChannelRaidEvent, type ChannelRaidSubscription, makeChannelRaidSubscription } from "./channel.raid.js"
40
- import { type ShieldModeBeginEvent, type ShieldModeBeginSubscription, makeShieldModeBeginSubscription } from "./channel.shield_mode.begin.js"
41
- import { type ShieldModeEndEvent, type ShieldModeEndSubscription, makeShieldModeEndSubscription } from "./channel.shield_mode.end.js"
42
- import { type ShoutoutCreateEvent, type ShoutoutCreateSubscription, makeShoutoutCreateSubscription } from "./channel.shoutout.create.js"
43
- import { type ShoutoutReceiveEvent, type ShoutoutReceiveSubscription, makeShoutoutReceiveSubscription } from "./channel.shoutout.receive.js"
44
- import { type ChannelSubscribeEvent, type ChannelSubscribeSubscription, makeChannelSubscribeSubscription } from "./channel.subscribe.js"
45
- import { type ChannelSubscriptionEndEvent, type ChannelSubscriptionEndSubscription, makeChannelSubscriptionEndSubscription } from "./channel.subscription.end.js"
46
- import { type ChannelSubscriptionGiftEvent, type ChannelSubscriptionGiftSubscription, makeChannelSubscriptionGiftSubscription } from "./channel.subscription.gift.js"
47
- import { type ChannelSubscriptionMessageEvent, type ChannelSubscriptionMessageSubscription, makeChannelSubscriptionMessageSubscription } from "./channel.subscription.message.js"
48
- import { type ChannelUnbanEvent, type ChannelUnbanSubscription, makeChannelUnbanSubscription } from "./channel.unban.js"
49
- import { type ChannelUpdateEvent, type ChannelUpdateSubscription, makeChannelUpdateSubscription } from "./channel.update.js"
50
- import { type StreamOfflineEvent, type StreamOfflineSubscription, makeStreamOfflineSubscription } from "./stream.offline.js"
51
- import { type StreamOnlineEvent, type StreamOnlineSubscription, makeStreamOnlineSubscription } from "./stream.online.js"
52
- import { type UserUpdateEvent, type UserUpdateSubscription, makeUserUpdateSubscription } from "./user.update.js"
53
-
54
- export * from "./channel.ad_break.begin.js"
55
- export * from "./channel.ban.js"
56
- export * from "./channel.channel_points_custom_reward.add.js"
57
- export * from "./channel.channel_points_custom_reward.remove.js"
58
- export * from "./channel.channel_points_custom_reward.update.js"
59
- export * from "./channel.channel_points_custom_reward_redemption.add.js"
60
- export * from "./channel.channel_points_custom_reward_redemption.update.js"
61
- export * from "./channel.charity_campaign.donate.js"
62
- export * from "./channel.charity_campaign.progress.js"
63
- export * from "./channel.charity_campaign.start.js"
64
- export * from "./channel.charity_campaign.stop.js"
65
- export * from "./channel.chat.clear.js"
66
- export * from "./channel.chat.clear_user_messages.js"
67
- export * from "./channel.chat.message_delete.js"
68
- export * from "./channel.chat.notification.js"
69
- export * from "./channel.cheer.js"
70
- export * from "./channel.follow.js"
71
- export * from "./channel.goal.begin.js"
72
- export * from "./channel.goal.end.js"
73
- export * from "./channel.goal.progress.js"
74
- export * from "./channel.guest_star_guest.update.js"
75
- export * from "./channel.guest_star_session.begin.js"
76
- export * from "./channel.guest_star_session.end.js"
77
- export * from "./channel.guest_star_settings.update.js"
78
- export * from "./channel.hype_train.begin.js"
79
- export * from "./channel.hype_train.end.js"
80
- export * from "./channel.hype_train.progress.js"
81
- export * from "./channel.moderator.add.js"
82
- export * from "./channel.moderator.remove.js"
83
- export * from "./channel.poll.begin.js"
84
- export * from "./channel.poll.end.js"
85
- export * from "./channel.poll.progress.js"
86
- export * from "./channel.prediction.begin.js"
87
- export * from "./channel.prediction.end.js"
88
- export * from "./channel.prediction.lock.js"
89
- export * from "./channel.prediction.progress.js"
90
- export * from "./channel.raid.js"
91
- export * from "./channel.shield_mode.begin.js"
92
- export * from "./channel.shield_mode.end.js"
93
- export * from "./channel.shoutout.create.js"
94
- export * from "./channel.shoutout.receive.js"
95
- export * from "./channel.subscribe.js"
96
- export * from "./channel.subscription.end.js"
97
- export * from "./channel.subscription.gift.js"
98
- export * from "./channel.subscription.message.js"
99
- export * from "./channel.unban.js"
100
- export * from "./channel.update.js"
101
- export * from "./stream.offline.js"
102
- export * from "./stream.online.js"
103
- export * from "./user.update.js"
104
-
105
- type AllSubscription =
106
- | ChannelAdBreakBeginSubscription
107
- | ChannelBanSubscription
108
- | ChannelChatClearSubscription
109
- | ChannelChatClearUserMessagesSubscription
110
- | ChannelChatMessageDeleteSubscription
111
- | ChannelChatNotificationSubscription
112
- | ChannelCheerSubscription
113
- | ChannelFollowSubscription
114
- | ChannelGuestStarGuestUpdateSubscription
115
- | ChannelGuestStarSessionBeginSubscription
116
- | ChannelGuestStarSessionEndSubscription
117
- | ChannelGuestStarSettingsUpdateSubscription
118
- | ChannelModeratorAddSubscription
119
- | ChannelModeratorRemoveSubscription
120
- | ChannelPointsCustomRewardAddSubscription
121
- | ChannelPointsCustomRewardRedemptionAddSubscription
122
- | ChannelPointsCustomRewardRedemptionUpdateSubscription
123
- | ChannelPointsCustomRewardRemoveSubscription
124
- | ChannelPointsCustomRewardUpdateSubscription
125
- | ChannelPollBeginSubscription
126
- | ChannelPollEndSubscription
127
- | ChannelPollProgressSubscription
128
- | ChannelPredictionBeginSubscription
129
- | ChannelPredictionEndSubscription
130
- | ChannelPredictionLockSubscription
131
- | ChannelPredictionProgressSubscription
132
- | ChannelRaidSubscription
133
- | ChannelSubscribeSubscription
134
- | ChannelSubscriptionEndSubscription
135
- | ChannelSubscriptionGiftSubscription
136
- | ChannelSubscriptionMessageSubscription
137
- | ChannelUnbanSubscription
138
- | ChannelUpdateSubscription
139
- | CharityCampaignProgressSubscription
140
- | CharityCampaignStartSubscription
141
- | CharityCampaignStopSubscription
142
- | CharityDonationSubscription
143
- | GoalBeginSubscription
144
- | GoalEndSubscription
145
- | GoalProgressSubscription
146
- | HypeTrainBeginSubscription
147
- | HypeTrainEndSubscription
148
- | HypeTrainProgressSubscription
149
- | ShieldModeBeginSubscription
150
- | ShieldModeEndSubscription
151
- | ShoutoutCreateSubscription
152
- | ShoutoutReceiveSubscription
153
- | StreamOfflineSubscription
154
- | StreamOnlineSubscription
155
- | UserUpdateSubscription
156
-
157
- type AllNotificationMessage =
158
- | NotificationMessage<ChannelAdBreakBeginSubscription, ChannelAdBreakBeginEvent>
159
- | NotificationMessage<ChannelBanSubscription, ChannelBanEvent>
160
- | NotificationMessage<ChannelChatClearSubscription, ChannelChatClearEvent>
161
- | NotificationMessage<ChannelChatClearUserMessagesSubscription, ChannelChatClearUserMessagesEvent>
162
- | NotificationMessage<ChannelChatMessageDeleteSubscription, ChannelChatMessageDeleteEvent>
163
- | NotificationMessage<ChannelChatNotificationSubscription, ChannelChatNotificationEvent>
164
- | NotificationMessage<ChannelCheerSubscription, ChannelCheerEvent>
165
- | NotificationMessage<ChannelFollowSubscription, ChannelFollowEvent>
166
- | NotificationMessage<ChannelGuestStarGuestUpdateSubscription, ChannelGuestStarGuestUpdateEvent>
167
- | NotificationMessage<ChannelGuestStarSessionBeginSubscription, ChannelGuestStarSessionBeginEvent>
168
- | NotificationMessage<ChannelGuestStarSessionEndSubscription, ChannelGuestStarSessionEndEvent>
169
- | NotificationMessage<ChannelGuestStarSettingsUpdateSubscription, ChannelGuestStarSettingsUpdateEvent>
170
- | NotificationMessage<ChannelModeratorAddSubscription, ChannelModeratorAddEvent>
171
- | NotificationMessage<ChannelModeratorRemoveSubscription, ChannelModeratorRemoveEvent>
172
- | NotificationMessage<ChannelPointsCustomRewardAddSubscription, ChannelPointsCustomRewardAddEvent>
173
- | NotificationMessage<ChannelPointsCustomRewardRedemptionAddSubscription, ChannelPointsCustomRewardRedemptionAddEvent>
174
- | NotificationMessage<ChannelPointsCustomRewardRedemptionUpdateSubscription, ChannelPointsCustomRewardRedemptionUpdateEvent>
175
- | NotificationMessage<ChannelPointsCustomRewardRemoveSubscription, ChannelPointsCustomRewardRemoveEvent>
176
- | NotificationMessage<ChannelPointsCustomRewardUpdateSubscription, ChannelPointsCustomRewardUpdateEvent>
177
- | NotificationMessage<ChannelPollBeginSubscription, ChannelPollBeginEvent>
178
- | NotificationMessage<ChannelPollEndSubscription, ChannelPollEndEvent>
179
- | NotificationMessage<ChannelPollProgressSubscription, ChannelPollProgressEvent>
180
- | NotificationMessage<ChannelPredictionBeginSubscription, ChannelPredictionBeginEvent>
181
- | NotificationMessage<ChannelPredictionEndSubscription, ChannelPredictionEndEvent>
182
- | NotificationMessage<ChannelPredictionLockSubscription, ChannelPredictionLockEvent>
183
- | NotificationMessage<ChannelPredictionProgressSubscription, ChannelPredictionProgressEvent>
184
- | NotificationMessage<ChannelRaidSubscription, ChannelRaidEvent>
185
- | NotificationMessage<ChannelSubscribeSubscription, ChannelSubscribeEvent>
186
- | NotificationMessage<ChannelSubscriptionEndSubscription, ChannelSubscriptionEndEvent>
187
- | NotificationMessage<ChannelSubscriptionGiftSubscription, ChannelSubscriptionGiftEvent>
188
- | NotificationMessage<ChannelSubscriptionMessageSubscription, ChannelSubscriptionMessageEvent>
189
- | NotificationMessage<ChannelUnbanSubscription, ChannelUnbanEvent>
190
- | NotificationMessage<ChannelUpdateSubscription, ChannelUpdateEvent>
191
- | NotificationMessage<CharityCampaignProgressSubscription, CharityCampaignProgressEvent>
192
- | NotificationMessage<CharityCampaignStartSubscription, CharityCampaignStartEvent>
193
- | NotificationMessage<CharityCampaignStopSubscription, CharityCampaignStopEvent>
194
- | NotificationMessage<CharityDonationSubscription, CharityDonationEvent>
195
- | NotificationMessage<GoalBeginSubscription, GoalBeginEvent>
196
- | NotificationMessage<GoalEndSubscription, GoalEndEvent>
197
- | NotificationMessage<GoalProgressSubscription, GoalProgressEvent>
198
- | NotificationMessage<HypeTrainBeginSubscription, HypeTrainBeginEvent>
199
- | NotificationMessage<HypeTrainEndSubscription, HypeTrainEndEvent>
200
- | NotificationMessage<HypeTrainProgressSubscription, HypeTrainProgressEvent>
201
- | NotificationMessage<ShieldModeBeginSubscription, ShieldModeBeginEvent>
202
- | NotificationMessage<ShieldModeEndSubscription, ShieldModeEndEvent>
203
- | NotificationMessage<ShoutoutCreateSubscription, ShoutoutCreateEvent>
204
- | NotificationMessage<ShoutoutReceiveSubscription, ShoutoutReceiveEvent>
205
- | NotificationMessage<StreamOfflineSubscription, StreamOfflineEvent>
206
- | NotificationMessage<StreamOnlineSubscription, StreamOnlineEvent>
207
- | NotificationMessage<UserUpdateSubscription, UserUpdateEvent>
208
-
209
- export type TwitchSubscriptionType = AllSubscription["type"]
210
-
211
- export type TwitchSubscription<
212
- Type extends TwitchSubscriptionType = TwitchSubscriptionType,
213
- > = Extract<AllSubscription, { type: Type }>
214
-
215
- export type TwitchNotificationMessage<
216
- Type extends TwitchSubscriptionType = TwitchSubscriptionType,
217
- > = Extract<AllNotificationMessage, { payload: { type: Type } }>
218
-
219
- const subscriptionBuilders: {
220
- [Type in TwitchSubscriptionType]: (userId: string) => TwitchSubscription<Type>
221
- } = {
222
- "channel.ad_break.begin": makeChannelAdBreakBeginSubscription,
223
- "channel.ban": makeChannelBanSubscription,
224
- "channel.channel_points_custom_reward.add": makeChannelPointsCustomRewardAddSubscription,
225
- "channel.channel_points_custom_reward.remove": makeChannelPointsCustomRewardRemoveSubscription,
226
- "channel.channel_points_custom_reward.update": makeChannelPointsCustomRewardUpdateSubscription,
227
- "channel.channel_points_custom_reward_redemption.add": makeChannelPointsCustomRewardRedemptionAddSubscription,
228
- "channel.channel_points_custom_reward_redemption.update": makeChannelPointsCustomRewardRedemptionUpdateSubscription,
229
- "channel.charity_campaign.donate": makeCharityDonationSubscription,
230
- "channel.charity_campaign.progress": makeCharityCampaignProgressSubscription,
231
- "channel.charity_campaign.start": makeCharityCampaignStartSubscription,
232
- "channel.charity_campaign.stop": makeCharityCampaignStopSubscription,
233
- "channel.chat.clear": makeChannelChatClearSubscription,
234
- "channel.chat.clear_user_messages": makeChannelChatClearUserMessagesSubscription,
235
- "channel.chat.message_delete": makeChannelChatMessageDeleteSubscription,
236
- "channel.chat.notification": makeChannelChatNotificationSubscription,
237
- "channel.cheer": makeChannelCheerSubscription,
238
- "channel.follow": makeChannelFollowSubscription,
239
- "channel.goal.begin": makeGoalBeginSubscription,
240
- "channel.goal.end": makeGoalEndSubscription,
241
- "channel.goal.progress": makeGoalProgressSubscription,
242
- "channel.guest_star_guest.update": makeChannelGuestStarGuestUpdateSubscription,
243
- "channel.guest_star_session.begin": makeChannelGuestStarSessionBeginSubscription,
244
- "channel.guest_star_session.end": makeChannelGuestStarSessionEndSubscription,
245
- "channel.guest_star_settings.update": makeChannelGuestStarSettingsUpdateSubscription,
246
- "channel.hype_train.begin": makeHypeTrainBeginSubscription,
247
- "channel.hype_train.end": makeHypeTrainEndSubscription,
248
- "channel.hype_train.progress": makeHypeTrainProgressSubscription,
249
- "channel.moderator.add": makeChannelModeratorAddSubscription,
250
- "channel.moderator.remove": makeChannelModeratorRemoveSubscription,
251
- "channel.poll.begin": makeChannelPollBeginSubscription,
252
- "channel.poll.end": makeChannelPollEndSubscription,
253
- "channel.poll.progress": makeChannelPollProgressSubscription,
254
- "channel.prediction.begin": makeChannelPredictionBeginSubscription,
255
- "channel.prediction.end": makeChannelPredictionEndSubscription,
256
- "channel.prediction.lock": makeChannelPredictionLockSubscription,
257
- "channel.prediction.progress": makeChannelPredictionProgressSubscription,
258
- "channel.raid": makeChannelRaidSubscription,
259
- "channel.shield_mode.begin": makeShieldModeBeginSubscription,
260
- "channel.shield_mode.end": makeShieldModeEndSubscription,
261
- "channel.shoutout.create": makeShoutoutCreateSubscription,
262
- "channel.shoutout.receive": makeShoutoutReceiveSubscription,
263
- "channel.subscribe": makeChannelSubscribeSubscription,
264
- "channel.subscription.end": makeChannelSubscriptionEndSubscription,
265
- "channel.subscription.gift": makeChannelSubscriptionGiftSubscription,
266
- "channel.subscription.message": makeChannelSubscriptionMessageSubscription,
267
- "channel.unban": makeChannelUnbanSubscription,
268
- "channel.update": makeChannelUpdateSubscription,
269
- "stream.offline": makeStreamOfflineSubscription,
270
- "stream.online": makeStreamOnlineSubscription,
271
- "user.update": makeUserUpdateSubscription,
272
- }
273
-
274
- export function buildSubscription<
275
- Type extends TwitchSubscriptionType,
276
- Subscription extends TwitchSubscription<Type>,
277
- >(type: Type, userId: string): Subscription {
278
- const creator = subscriptionBuilders[type]
279
- if (!creator) {
280
- throw new Error(`Unknown type ${type}`)
281
- }
282
-
283
- return creator(userId) as Subscription
284
- }
1
+ import "./automod.message.hold-2.ts"
2
+ import "./automod.message.update-2.ts"
3
+ import "./automod.settings.update-1.ts"
4
+ import "./automod.terms.update-1.ts"
5
+ import "./channel.ad_break.begin-1.ts"
6
+ import "./channel.ban-1.ts"
7
+ import "./channel.bits.use-1.ts"
8
+ import "./channel.channel_points_automatic_reward_redemption.add-2.ts"
9
+ import "./channel.channel_points_custom_reward.add-1.ts"
10
+ import "./channel.channel_points_custom_reward.remove-1.ts"
11
+ import "./channel.channel_points_custom_reward.update-1.ts"
12
+ import "./channel.channel_points_custom_reward_redemption.add-1.ts"
13
+ import "./channel.channel_points_custom_reward_redemption.update-1.ts"
14
+ import "./channel.charity_campaign.donate-1.ts"
15
+ import "./channel.charity_campaign.progress-1.ts"
16
+ import "./channel.charity_campaign.start-1.ts"
17
+ import "./channel.charity_campaign.stop-1.ts"
18
+ import "./channel.chat.clear-1.ts"
19
+ import "./channel.chat.clear_user_messages-1.ts"
20
+ import "./channel.chat.message-1.ts"
21
+ import "./channel.chat.message_delete-1.ts"
22
+ import "./channel.chat.notification-1.ts"
23
+ import "./channel.chat.user_message_hold-1.ts"
24
+ import "./channel.chat.user_message_update-1.ts"
25
+ import "./channel.chat_settings.update-1.ts"
26
+ import "./channel.cheer-1.ts"
27
+ import "./channel.follow-2.ts"
28
+ import "./channel.goal.begin-1.ts"
29
+ import "./channel.goal.end-1.ts"
30
+ import "./channel.goal.progress-1.ts"
31
+ import "./channel.guest_star_guest.update-beta.ts"
32
+ import "./channel.guest_star_session.begin-beta.ts"
33
+ import "./channel.guest_star_session.end-beta.ts"
34
+ import "./channel.guest_star_settings.update-beta.ts"
35
+ import "./channel.hype_train.begin-2.ts"
36
+ import "./channel.hype_train.end-2.ts"
37
+ import "./channel.hype_train.progress-2.ts"
38
+ import "./channel.moderate-2.ts"
39
+ import "./channel.moderator.add-1.ts"
40
+ import "./channel.moderator.remove-1.ts"
41
+ import "./channel.poll.begin-1.ts"
42
+ import "./channel.poll.end-1.ts"
43
+ import "./channel.poll.progress-1.ts"
44
+ import "./channel.prediction.begin-1.ts"
45
+ import "./channel.prediction.end-1.ts"
46
+ import "./channel.prediction.lock-1.ts"
47
+ import "./channel.prediction.progress-1.ts"
48
+ import "./channel.raid-1.ts"
49
+ import "./channel.shared_chat.begin-1.ts"
50
+ import "./channel.shared_chat.end-1.ts"
51
+ import "./channel.shared_chat.update-1.ts"
52
+ import "./channel.shield_mode.begin-1.ts"
53
+ import "./channel.shield_mode.end-1.ts"
54
+ import "./channel.shoutout.create-1.ts"
55
+ import "./channel.shoutout.receive-1.ts"
56
+ import "./channel.subscribe-1.ts"
57
+ import "./channel.subscription.end-1.ts"
58
+ import "./channel.subscription.gift-1.ts"
59
+ import "./channel.subscription.message-1.ts"
60
+ import "./channel.suspicious_user.message-1.ts"
61
+ import "./channel.suspicious_user.update-1.ts"
62
+ import "./channel.unban-1.ts"
63
+ import "./channel.unban_request.create-1.ts"
64
+ import "./channel.unban_request.resolve-1.ts"
65
+ import "./channel.update-2.ts"
66
+ import "./channel.vip.add-1.ts"
67
+ import "./channel.vip.remove-1.ts"
68
+ import "./channel.warning.acknowledge-1.ts"
69
+ import "./channel.warning.send-1.ts"
70
+ import "./stream.offline-1.ts"
71
+ import "./stream.online-1.ts"
72
+ import "./user.update-1.ts"
73
+ import "./user.whisper.message-1.ts"
@@ -0,0 +1,38 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "stream.offline": StreamOffline
6
+ }
7
+ }
8
+
9
+ /** Stream Offline v1: When the specified broadcaster stops a stream. */
10
+ type StreamOffline = EventConfig<{
11
+ Type: "stream.offline"
12
+ Version: "1"
13
+ /** The conditions to listen for when the specified broadcaster stops a stream. */
14
+ Condition: {
15
+ /** The broadcaster user ID you want to get stream offline notifications for. */
16
+ broadcaster_user_id: string
17
+ }
18
+ /** The event fired when the specified broadcaster stops a stream. */
19
+ Event: {
20
+ /** The broadcaster's user id. */
21
+ broadcaster_user_id: string
22
+ /** The broadcaster's user login. */
23
+ broadcaster_user_login: string
24
+ /** The broadcaster's user display name. */
25
+ broadcaster_user_name: string
26
+ }
27
+ }>
28
+
29
+ registerEvent("stream.offline", {
30
+ scopes: [],
31
+ subscriber: (userId) => ({
32
+ type: "stream.offline",
33
+ version: "1",
34
+ condition: {
35
+ broadcaster_user_id: userId,
36
+ },
37
+ }),
38
+ })
@@ -0,0 +1,44 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "stream.online": StreamOnline
6
+ }
7
+ }
8
+
9
+ /** Stream Online v1: When the specified broadcaster starts a stream. */
10
+ type StreamOnline = EventConfig<{
11
+ Type: "stream.online"
12
+ Version: "1"
13
+ /** The conditions to listen for when the specified broadcaster starts a stream. */
14
+ Condition: {
15
+ /** The broadcaster user ID you want to get stream online notifications for. */
16
+ broadcaster_user_id: string
17
+ }
18
+ /** The event fired when the specified broadcaster starts a stream. */
19
+ Event: {
20
+ /** The id of the stream. */
21
+ id: string
22
+ /** The broadcaster's user id. */
23
+ broadcaster_user_id: string
24
+ /** The broadcaster's user login. */
25
+ broadcaster_user_login: string
26
+ /** The broadcaster's user display name. */
27
+ broadcaster_user_name: string
28
+ /** The stream type. Valid values are: live, playlist, watch_party, premiere, rerun. */
29
+ type: string
30
+ /** The timestamp at which the stream went online at. */
31
+ started_at: string
32
+ }
33
+ }>
34
+
35
+ registerEvent("stream.online", {
36
+ scopes: [],
37
+ subscriber: (userId) => ({
38
+ type: "stream.online",
39
+ version: "1",
40
+ condition: {
41
+ broadcaster_user_id: userId,
42
+ },
43
+ }),
44
+ })
@@ -0,0 +1,48 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "user.update": UserUpdate
6
+ }
7
+ }
8
+
9
+ /** User Update v1: When a user has updated their account. */
10
+ type UserUpdate = EventConfig<{
11
+ Type: "user.update"
12
+ Version: "1"
13
+ /** The conditions to listen for when a user has updated their account. */
14
+ Condition: {
15
+ /** The user ID for the user you want update notifications for. */
16
+ user_id: string
17
+ }
18
+ /** The event fired when a user has updated their account. */
19
+ Event: {
20
+ /** The user's user id. */
21
+ user_id: string
22
+ /** The user's user login. */
23
+ user_login: string
24
+ /** The user's user display name. */
25
+ user_name: string
26
+ /** The user's email address. The event includes the user's email address only if the app used to request this event type includes the user:read:email scope for the user; otherwise, the field is set to an empty string. See "Create EventSub Subscription". */
27
+ email: string
28
+ /**
29
+ * A Boolean value that determines whether Twitch has verified the user's email address. Is true if Twitch has verified the email address; otherwise, false.
30
+ *
31
+ * NOTE: Ignore this field if the email field contains an empty string.
32
+ */
33
+ email_verified: boolean
34
+ /** The user's description. */
35
+ description: string
36
+ }
37
+ }>
38
+
39
+ registerEvent("user.update", {
40
+ scopes: ["user:read:email"],
41
+ subscriber: (userId) => ({
42
+ type: "user.update",
43
+ version: "1",
44
+ condition: {
45
+ user_id: userId,
46
+ },
47
+ }),
48
+ })