@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overlaysymphony/twitch",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Twitch module for the OverlaySymphony interactive streaming framework.",
5
5
  "homepage": "https://github.com/OverlaySymphony/overlaysymphony",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@overlaysymphony/core": "0.2.0"
17
+ "@overlaysymphony/core": "0.2.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@vitest/coverage-v8": "^2.1.2",
@@ -1,4 +1,4 @@
1
- import { type TwitchUser, getUsers } from "../helix/users/index.js"
1
+ import { type TwitchUser, getUsers } from "../helix/users/index.ts"
2
2
 
3
3
  export interface Authentication {
4
4
  tokenType: "bearer"
@@ -1 +1 @@
1
- export * from "./authentication.js"
1
+ export * from "./authentication.ts"
package/src/chat/chat.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import createDefer from "@overlaysymphony/core/libs/defer"
2
2
  import createPubSub from "@overlaysymphony/core/libs/pubsub"
3
3
 
4
- import { type Authentication } from "../authentication/index.js"
4
+ import { type Authentication } from "../authentication/index.ts"
5
5
 
6
6
  import {
7
7
  type TwitchChatEvent,
8
8
  type TwitchChatEventType,
9
- } from "./interfaces/index.js"
10
- import parseCommand from "./parser.js"
9
+ } from "./interfaces/index.ts"
10
+ import parseCommand from "./parser.ts"
11
11
 
12
12
  type ChatListener = (callback: (event: TwitchChatEvent) => void) => () => void
13
13
 
@@ -44,7 +44,7 @@ export interface TwitchChat {
44
44
  onCommand: ChatCommandSubscriber
45
45
  }
46
46
 
47
- export async function createChat(
47
+ export default async function createChat(
48
48
  authentication: Authentication,
49
49
  channel: string = authentication.user.login,
50
50
  ): Promise<TwitchChat> {
@@ -12,7 +12,7 @@ export function isBroadcaster(event: ApplicableChatEvent): boolean | null {
12
12
 
13
13
  if (typeof broadcaster === "undefined") return null
14
14
 
15
- return !!broadcaster
15
+ return broadcaster
16
16
  }
17
17
 
18
18
  export function isMod(event: ApplicableChatEvent): boolean | null {
package/src/chat/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export type {
2
2
  TwitchChatEventType,
3
3
  TwitchChatEvent,
4
- } from "./interfaces/index.js"
4
+ } from "./interfaces/index.ts"
5
5
 
6
- export * from "./chat.js"
7
- export * from "./helpers.js"
6
+ export { default } from "./chat.ts"
7
+ export * from "./chat.ts"
8
+ export * from "./helpers.ts"
@@ -1,6 +1,6 @@
1
- import { type ChatEvent } from "./events.js"
1
+ import { type ChatEvent } from "./events.ts"
2
2
 
3
- export type { ChatEvent, ChatEventSource } from "./events.js"
3
+ export type { ChatEvent, ChatEventSource } from "./events.ts"
4
4
 
5
5
  export type TwitchChatEventType = ChatEvent["type"]
6
6
 
@@ -1,4 +1,4 @@
1
- import { type ChatEvent, type ChatEventSource } from "./interfaces/index.js"
1
+ import { type ChatEvent, type ChatEventSource } from "./interfaces/index.ts"
2
2
 
3
3
  // Parses an IRC message and returns a JSON object with the message's
4
4
  // component parts (tags, source (nick and host), command, parameters).
@@ -0,0 +1,81 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "automod.message.hold": AutomodMessageHold
6
+ }
7
+ }
8
+
9
+ /** Automod Message Hold v2: When the user's message is caught by automod for review. Only public blocked terms trigger notifications, not private ones. */
10
+ type AutomodMessageHold = EventConfig<{
11
+ Type: "automod.message.hold"
12
+ Version: "2"
13
+ /** The conditions to listen for when the user's message is caught by automod for review. Only public blocked terms trigger notifications, not private ones. */
14
+ Condition: {
15
+ /** User ID of the broadcaster (channel). */
16
+ broadcaster_user_id: string
17
+ /** User ID of the moderator. */
18
+ moderator_user_id: string
19
+ }
20
+ /** The event fired when the user's message is caught by automod for review. Only public blocked terms trigger notifications, not private ones. */
21
+ Event: {
22
+ /** The ID of the broadcaster specified in the request. */
23
+ broadcaster_user_id: string
24
+ /** The login of the broadcaster specified in the request. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster specified in the request. */
27
+ broadcaster_user_name: string
28
+ /** The message sender's user ID. */
29
+ user_id: string
30
+ /** The message sender's login name. */
31
+ user_login: string
32
+ /** The message sender's display name. */
33
+ user_name: string
34
+ /** The ID of the message that was flagged by automod. */
35
+ message_id: string
36
+ /** The body of the message. */
37
+ message: {
38
+ /** The contents of the message caught by automod. */
39
+ text: string
40
+ /** Metadata surrounding the potential inappropriate fragments of the message. */
41
+ fragments: Array<{
42
+ /** Message text in a fragment. */
43
+ text: string
44
+ /** Metadata pertaining to the emote. */
45
+ emote?: {
46
+ /** An ID that uniquely identifies this emote. */
47
+ id: string
48
+ /** An ID that identifies the emote set that the emote belongs to. */
49
+ emote_set_id: string
50
+ }
51
+ /** Metadata pertaining to the cheermote. */
52
+ cheermote?: {
53
+ /** The name portion of the Cheermote string that you use in chat to cheer Bits. The full Cheermote string is the concatenation of {prefix} + {number of Bits}. */
54
+ prefix: string
55
+ /** The amount of Bits cheered. */
56
+ bits: number
57
+ /** The tier level of the cheermote. */
58
+ tier: number
59
+ }
60
+ }>
61
+ }
62
+ /** The category of the message. */
63
+ category: string
64
+ /** The level of severity. Measured between 1 to 4. */
65
+ level: number
66
+ /** The timestamp of when automod saved the message. */
67
+ held_at: string
68
+ }
69
+ }>
70
+
71
+ registerEvent("automod.message.hold", {
72
+ scopes: ["moderator:manage:automod"],
73
+ subscriber: (userId) => ({
74
+ type: "automod.message.hold",
75
+ version: "2",
76
+ condition: {
77
+ broadcaster_user_id: userId,
78
+ moderator_user_id: userId,
79
+ },
80
+ }),
81
+ })
@@ -0,0 +1,94 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "automod.message.update": AutomodMessageUpdate
6
+ }
7
+ }
8
+
9
+ /** Automod Message Update v2: When a message in the automod queue had its status changed. Only public blocked terms trigger notifications, not private ones. */
10
+ type AutomodMessageUpdate = EventConfig<{
11
+ Type: "automod.message.update"
12
+ Version: "2"
13
+ /** The conditions to listen for when a message in the automod queue had its status changed. Only public blocked terms trigger notifications, not private ones. */
14
+ Condition: {
15
+ /** User ID of the broadcaster (channel). Maximum:1. */
16
+ broadcaster_user_id: string
17
+ /** User ID of the moderator. */
18
+ moderator_user_id: string
19
+ }
20
+ /** The event fired when a message in the automod queue had its status changed. Only public blocked terms trigger notifications, not private ones. */
21
+ Event: {
22
+ /** The ID of the broadcaster specified in the request. */
23
+ broadcaster_user_id: string
24
+ /** The login of the broadcaster specified in the request. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster specified in the request. */
27
+ broadcaster_user_name: string
28
+ /** The message sender's user ID. */
29
+ user_id: string
30
+ /** The message sender's login name. */
31
+ user_login: string
32
+ /** The message sender's display name. */
33
+ user_name: string
34
+ /** The ID of the moderator. */
35
+ moderator_user_id: string
36
+ /** TThe moderator's user name. */
37
+ moderator_user_name: string
38
+ /** The login of the moderator. */
39
+ moderator_user_login: string
40
+ /** The ID of the message that was flagged by automod. */
41
+ message_id: string
42
+ /** The body of the message. */
43
+ message: {
44
+ /** The contents of the message caught by automod. */
45
+ text: string
46
+ /** Metadata surrounding the potential inappropriate fragments of the message. */
47
+ fragments: Array<{
48
+ /** Message text in a fragment. */
49
+ text: string
50
+ /** Metadata pertaining to the emote. */
51
+ emote?: {
52
+ /** An ID that uniquely identifies this emote. */
53
+ id: string
54
+ /** An ID that identifies the emote set that the emote belongs to. */
55
+ emote_set_id: string
56
+ }
57
+ /** Metadata pertaining to the cheermote. */
58
+ cheermote?: {
59
+ /** The name portion of the Cheermote string that you use in chat to cheer Bits. The full Cheermote string is the concatenation of {prefix} + {number of Bits}. */
60
+ prefix: string
61
+ /** The amount of Bits cheered. */
62
+ bits: number
63
+ /** The tier level of the cheermote. */
64
+ tier: number
65
+ }
66
+ }>
67
+ }
68
+ /** The category of the message. */
69
+ category: string
70
+ /** The level of severity. Measured between 1 to 4. */
71
+ level: number
72
+ /**
73
+ * The message's status. Possible values are:
74
+ * - Approved
75
+ * - Denied
76
+ * - Expired
77
+ */
78
+ status: string
79
+ /** The timestamp of when automod saved the message. */
80
+ held_at: string
81
+ }
82
+ }>
83
+
84
+ registerEvent("automod.message.update", {
85
+ scopes: ["moderator:manage:automod"],
86
+ subscriber: (userId) => ({
87
+ type: "automod.message.update",
88
+ version: "2",
89
+ condition: {
90
+ broadcaster_user_id: userId,
91
+ moderator_user_id: userId,
92
+ },
93
+ }),
94
+ })
@@ -0,0 +1,65 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "automod.settings.update": AutomodSettingsUpdate
6
+ }
7
+ }
8
+
9
+ /** Automod Settings Update v1: When the broadcaster's automod settings are updated. */
10
+ type AutomodSettingsUpdate = EventConfig<{
11
+ Type: "automod.settings.update"
12
+ Version: "1"
13
+ /** The conditions to listen for when the broadcaster's automod settings are updated. */
14
+ Condition: {
15
+ /** User ID of the broadcaster (channel). Maximum:1. */
16
+ broadcaster_user_id: string
17
+ /** User ID of the moderator. */
18
+ moderator_user_id: string
19
+ }
20
+ /** The event fired when the broadcaster's automod settings are updated. */
21
+ Event: {
22
+ /** The ID of the broadcaster specified in the request. */
23
+ broadcaster_user_id: string
24
+ /** The login of the broadcaster specified in the request. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster specified in the request. */
27
+ broadcaster_user_name: string
28
+ /** The ID of the moderator who changed the channel settings. */
29
+ moderator_user_id: string
30
+ /** The moderator's login. */
31
+ moderator_user_login: string
32
+ /** The moderator's user name. */
33
+ moderator_user_name: string
34
+ /** The Automod level for hostility involving name calling or insults. */
35
+ bullying: number
36
+ /** The default AutoMod level for the broadcaster. This field is null if the broadcaster has set one or more of the individual settings. */
37
+ overall_level: number
38
+ /** The Automod level for discrimination against disability. */
39
+ disability: number
40
+ /** The Automod level for racial discrimination. */
41
+ race_ethnicity_or_religion: number
42
+ /** The Automod level for discrimination against women. */
43
+ misogyny: number
44
+ /** The AutoMod level for discrimination based on sexuality, sex, or gender. */
45
+ sexuality_sex_or_gender: number
46
+ /** The Automod level for hostility involving aggression. */
47
+ aggression: number
48
+ /** The Automod level for sexual content. */
49
+ sex_based_terms: number
50
+ /** The Automod level for profanity. */
51
+ swearing: number
52
+ }
53
+ }>
54
+
55
+ registerEvent("automod.settings.update", {
56
+ scopes: ["moderator:read:automod"],
57
+ subscriber: (userId) => ({
58
+ type: "automod.settings.update",
59
+ version: "1",
60
+ condition: {
61
+ broadcaster_user_id: userId,
62
+ moderator_user_id: userId,
63
+ },
64
+ }),
65
+ })
@@ -0,0 +1,59 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "automod.terms.update": AutomodTermsUpdate
6
+ }
7
+ }
8
+
9
+ /** Automod Terms Update v1: When the broadcaster's automod terms are updated. Changes to private terms are not sent. */
10
+ type AutomodTermsUpdate = EventConfig<{
11
+ Type: "automod.terms.update"
12
+ Version: "1"
13
+ /** The conditions to listen for when the broadcaster's automod terms are updated. Changes to private terms are not sent. */
14
+ Condition: {
15
+ /** User ID of the broadcaster (channel). Maximum:1. */
16
+ broadcaster_user_id: string
17
+ /** User ID of the moderator creating the subscription. Maximum:1 */
18
+ moderator_user_id: string
19
+ }
20
+ /** The event fired when the broadcaster's automod terms are updated. Changes to private terms are not sent. */
21
+ Event: {
22
+ /** The ID of the broadcaster specified in the request. */
23
+ broadcaster_user_id: string
24
+ /** The login of the broadcaster specified in the request. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster specified in the request. */
27
+ broadcaster_user_name: string
28
+ /** The ID of the moderator who changed the channel settings. */
29
+ moderator_user_id: string
30
+ /** The moderator's login. */
31
+ moderator_user_login: string
32
+ /** The moderator's user name. */
33
+ moderator_user_name: string
34
+ /**
35
+ * The status change applied to the terms. Possible options are:
36
+ * - add_permitted
37
+ * - remove_permitted
38
+ * - add_blocked
39
+ * - remove_blocked
40
+ */
41
+ action: string
42
+ /** Indicates whether this term was added due to an Automod message approve/deny action. */
43
+ from_automod: boolean
44
+ /** The list of terms that had a status change. */
45
+ terms: string[]
46
+ }
47
+ }>
48
+
49
+ registerEvent("automod.terms.update", {
50
+ scopes: ["moderator:manage:automod"],
51
+ subscriber: (userId) => ({
52
+ type: "automod.terms.update",
53
+ version: "1",
54
+ condition: {
55
+ broadcaster_user_id: userId,
56
+ moderator_user_id: userId,
57
+ },
58
+ }),
59
+ })
@@ -0,0 +1,50 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "channel.ad_break.begin": ChannelAdBreakBegin
6
+ }
7
+ }
8
+
9
+ /** Channel Ad Break Begin v1: When a midroll commercial break has started running. */
10
+ type ChannelAdBreakBegin = EventConfig<{
11
+ Type: "channel.ad_break.begin"
12
+ Version: "1"
13
+ /** The conditions to listen for when a midroll commercial break has started running. */
14
+ Condition: {
15
+ /** The ID of the broadcaster that you want to get Channel Ad Break begin notifications for. Maximum: 1 */
16
+ broadcaster_id: string
17
+ }
18
+ /** The event fired when a midroll commercial break has started running. */
19
+ Event: {
20
+ /** Length in seconds of the mid-roll ad break requested */
21
+ duration_seconds: number
22
+ /** The UTC timestamp of when the ad break began, in RFC3339 format. Note that there is potential delay between this event, when the streamer requested the ad break, and when the viewers will see ads. */
23
+ started_at: string
24
+ /** Indicates if the ad was automatically scheduled via Ads Manager */
25
+ is_automatic: boolean
26
+ /** The broadcaster's user ID for the channel the ad was run on. */
27
+ broadcaster_user_id: string
28
+ /** The broadcaster's user login for the channel the ad was run on. */
29
+ broadcaster_user_login: string
30
+ /** The broadcaster's user display name for the channel the ad was run on. */
31
+ broadcaster_user_name: string
32
+ /** The ID of the user that requested the ad. For automatic ads, this will be the ID of the broadcaster. */
33
+ requester_user_id: string
34
+ /** The login of the user that requested the ad. */
35
+ requester_user_login: string
36
+ /** The display name of the user that requested the ad. */
37
+ requester_user_name: string
38
+ }
39
+ }>
40
+
41
+ registerEvent("channel.ad_break.begin", {
42
+ scopes: ["channel:read:ads"],
43
+ subscriber: (userId) => ({
44
+ type: "channel.ad_break.begin",
45
+ version: "1",
46
+ condition: {
47
+ broadcaster_id: userId,
48
+ },
49
+ }),
50
+ })
@@ -0,0 +1,58 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "channel.ban": ChannelBan
6
+ }
7
+ }
8
+
9
+ /** Channel Ban v1: When a viewer is banned from the specified channel. */
10
+ type ChannelBan = EventConfig<{
11
+ Type: "channel.ban"
12
+ Version: "1"
13
+ /** The conditions to listen for when a viewer is banned from the specified channel. */
14
+ Condition: {
15
+ /** The broadcaster user ID for the channel you want to get ban notifications for. */
16
+ broadcaster_user_id: string
17
+ }
18
+ /** The event fired when a viewer is banned from the specified channel. */
19
+ Event: {
20
+ /** The user ID for the user who was banned on the specified channel. */
21
+ user_id: string
22
+ /** The user login for the user who was banned on the specified channel. */
23
+ user_login: string
24
+ /** The user display name for the user who was banned on the specified channel. */
25
+ user_name: string
26
+ /** The requested broadcaster ID. */
27
+ broadcaster_user_id: string
28
+ /** The requested broadcaster login. */
29
+ broadcaster_user_login: string
30
+ /** The requested broadcaster display name. */
31
+ broadcaster_user_name: string
32
+ /** The user ID of the issuer of the ban. */
33
+ moderator_user_id: string
34
+ /** The user login of the issuer of the ban. */
35
+ moderator_user_login: string
36
+ /** The user name of the issuer of the ban. */
37
+ moderator_user_name: string
38
+ /** The reason behind the ban. */
39
+ reason: string
40
+ /** The UTC date and time (in RFC3339 format) of when the user was banned or put in a timeout. */
41
+ banned_at: string
42
+ /** The UTC date and time (in RFC3339 format) of when the timeout ends. Is null if the user was banned instead of put in a timeout. */
43
+ ends_at: string
44
+ /** Indicates whether the ban is permanent (true) or a timeout (false). If true, ends_at will be null. */
45
+ is_permanent: boolean
46
+ }
47
+ }>
48
+
49
+ registerEvent("channel.ban", {
50
+ scopes: ["channel:moderate"],
51
+ subscriber: (userId) => ({
52
+ type: "channel.ban",
53
+ version: "1",
54
+ condition: {
55
+ broadcaster_user_id: userId,
56
+ },
57
+ }),
58
+ })
@@ -0,0 +1,112 @@
1
+ import { type EventConfig, registerEvent } from "../events-helpers.ts"
2
+
3
+ declare module "../events-helpers.ts" {
4
+ interface EventConfigs {
5
+ "channel.bits.use": ChannelBitsUse
6
+ }
7
+ }
8
+
9
+ /** Channel Bits Use v1: When Bits are used on a channel. */
10
+ type ChannelBitsUse = EventConfig<{
11
+ Type: "channel.bits.use"
12
+ Version: "1"
13
+ /** The conditions to listen for when Bits are used on a channel. */
14
+ Condition: {
15
+ /** The user ID of the channel broadcaster. Maximum: 1. */
16
+ broadcaster_user_id: string
17
+ }
18
+ /** The event fired when Bits are used on a channel. */
19
+ Event: {
20
+ /** The User ID of the channel where the Bits were redeemed. */
21
+ broadcaster_user_id: string
22
+ /** The login of the channel where the Bits were used. */
23
+ broadcaster_user_login: string
24
+ /** The display name of the channel where the Bits were used. */
25
+ broadcaster_user_name: string
26
+ /** The User ID of the redeeming user. */
27
+ user_id: string
28
+ /** The login name of the redeeming user. */
29
+ user_login: string
30
+ /** The display name of the redeeming user. */
31
+ user_name: string
32
+ /** The number of Bits used. */
33
+ bits: number
34
+ /**
35
+ * Possible values are:
36
+ * - cheer
37
+ * - power_up
38
+ */
39
+ type: string
40
+ /** An object that contains the user message and emote information needed to recreate the message. */
41
+ message?: {
42
+ /** The chat message in plain text. */
43
+ text: string
44
+ /** The ordered list of chat message fragments. */
45
+ fragments: Array<{
46
+ /** The message text in fragment. */
47
+ text: string
48
+ /**
49
+ * The type of message fragment. Possible values are:
50
+ * - text
51
+ * - cheermote
52
+ * - emote
53
+ */
54
+ type: string
55
+ /** The metadata pertaining to the emote. */
56
+ emote?: {
57
+ /** The ID that uniquely identifies this emote. */
58
+ id: string
59
+ /** The ID that identifies the emote set that the emote belongs to. */
60
+ emote_set_id: string
61
+ /** The ID of the broadcaster who owns the emote. */
62
+ owner_id: string
63
+ /**
64
+ * The formats that the emote is available in.
65
+ * - animated - An animated GIF is available for this emote.
66
+ * - static - A static PNG file is available for this emote.
67
+ */
68
+ format: string[]
69
+ }
70
+ /** The metadata pertaining to the cheermote. */
71
+ cheermote?: {
72
+ /** The name portion of the Cheermote string that you use in chat to cheer Bits. The full Cheermote string is the concatenation of {prefix} + {number of Bits}. */
73
+ prefix: string
74
+ /** The amount of Bits cheered. */
75
+ bits: number
76
+ /** The tier level of the cheermote. */
77
+ tier: number
78
+ }
79
+ }>
80
+ }
81
+ /** Data about Power-up. */
82
+ power_up?: {
83
+ /**
84
+ * Possible values:
85
+ * - message_effect
86
+ * - celebration
87
+ * - gigantify_an_emote
88
+ */
89
+ type: string
90
+ /** Emote associated with the reward. */
91
+ emote?: {
92
+ /** The ID that uniquely identifies this emote. */
93
+ id: string
94
+ /** The human readable emote token. */
95
+ name: string
96
+ }
97
+ /** The ID of the message effect. */
98
+ message_effect_id?: string
99
+ }
100
+ }
101
+ }>
102
+
103
+ registerEvent("channel.bits.use", {
104
+ scopes: ["bits:read"],
105
+ subscriber: (userId) => ({
106
+ type: "channel.bits.use",
107
+ version: "1",
108
+ condition: {
109
+ broadcaster_user_id: userId,
110
+ },
111
+ }),
112
+ })