Skip to content

Commit 7b3edb2

Browse files
authored
Add Shared chat & Chat Notification event types (#37)
* Add Shared chat event types * Change nullability
1 parent 6c8af1b commit 7b3edb2

7 files changed

+182
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
namespace TwitchLib.EventSub.Core.Models.SharedChat;
2+
3+
public abstract class ChannelSharedChatSessionBase
4+
{
5+
/// <summary>
6+
/// The broadcaster user ID
7+
/// </summary>
8+
public string BroadcasterUserId { get; set; } = string.Empty;
9+
/// <summary>
10+
/// The broadcaster display name
11+
/// </summary>
12+
public string BroadcasterUserName { get; set; } = string.Empty;
13+
/// <summary>
14+
/// The broadcaster login
15+
/// </summary>
16+
public string BroadcasterUserLogin { get; set; } = string.Empty;
17+
/// <summary>
18+
/// The broadcaster user ID hosting shared chat
19+
/// </summary>
20+
public string HostBroadcasterUserId { get; set; } = string.Empty;
21+
/// <summary>
22+
/// The broadcaster display name hosting shared chat
23+
/// </summary>
24+
public string HostBroadcasterUserName { get; set; } = string.Empty;
25+
/// <summary>
26+
/// The broadcaster login hosting shared chat
27+
/// </summary>
28+
public string HostBroadcasterUserLogin { get; set; } = string.Empty;
29+
/// <summary>
30+
/// Unique ID representing the session.
31+
/// </summary>
32+
public string SessionId { get; set; } = string.Empty;
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace TwitchLib.EventSub.Core.Models.SharedChat;
2+
3+
/// <summary>
4+
/// A participant in the shared chat session.
5+
/// </summary>
6+
public class SharedChatParticipant
7+
{
8+
/// <summary>
9+
/// The User ID of the participant's channel.
10+
/// </summary>
11+
public string BroadcasterUserId { get; protected set; } = string.Empty;
12+
/// <summary>
13+
/// The User name of the participant's channel.
14+
/// </summary>
15+
public string BroadcasterUserName { get; protected set; } = string.Empty;
16+
/// <summary>
17+
/// The User login of the participant's channel.
18+
/// </summary>
19+
public string BroadcasterUserLogin { get; protected set; } = string.Empty;
20+
}

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelChatMessage.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public sealed class ChannelChatMessage
5252
/// <para>channel_points_highlighted</para>
5353
/// <para>channel_points_sub_only</para>
5454
/// <para>user_intro</para>
55+
/// <para>power_ups_message_effect</para>
56+
/// <para>power_ups_gigantified_emote</para>
5557
public string MessageType { get; set; } = string.Empty;
5658

5759
/// <summary>
@@ -65,32 +67,32 @@ public sealed class ChannelChatMessage
6567
/// <summary>
6668
/// Optional. The ID of a channel points custom reward that was redeemed.
6769
/// </summary>
68-
public string ChannelPointsCustomRewardId { get; set; } = string.Empty;
70+
public string? ChannelPointsCustomRewardId { get; set; } = string.Empty;
6971

7072
/// <summary>
7173
/// Optional. The broadcaster user ID of the channel the message was sent from.
7274
/// </summary>
73-
public string SourceBroadcasterUserId { get; set; } = string.Empty;
75+
public string? SourceBroadcasterUserId { get; set; } = string.Empty;
7476

7577
/// <summary>
7678
/// Optional. The user name of the broadcaster of the channel the message was sent from.
7779
/// </summary>
78-
public string SourceBroadcasterUserName { get; set; } = string.Empty;
80+
public string? SourceBroadcasterUserName { get; set; } = string.Empty;
7981

8082
/// <summary>
8183
/// Optional. The login of the broadcaster of the channel the message was sent from.
8284
/// </summary>
83-
public string SourceBroadcasterUserLogin { get; set; } = string.Empty;
85+
public string? SourceBroadcasterUserLogin { get; set; } = string.Empty;
8486

8587
/// <summary>
8688
/// Optional. The UUID that identifies the source message from the channel the message was sent from.
8789
/// </summary>
88-
public string SourceMessageId { get; set; } = string.Empty;
90+
public string? SourceMessageId { get; set; } = string.Empty;
8991

9092
/// <summary>
9193
/// Optional. The list of chat badges for the chatter in the channel the message was sent from.
9294
/// </summary>
93-
public ChatBadge[] SourceBadges { get; set; } = [];
95+
public ChatBadge[]? SourceBadges { get; set; } = [];
9496

9597
/// <summary>
9698
/// Returns true if viewer is a subscriber

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelChatNotification.cs

+71
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ public sealed class ChannelChatNotification
7373
/// <para>announcement</para>
7474
/// <para>bits_badge_tier</para>
7575
/// <para>charity_donation</para>
76+
/// <para>shared_chat_sub</para>
77+
/// <para>shared_chat_resub</para>
78+
/// <para>shared_chat_sub_gift</para>
79+
/// <para>shared_chat_community_sub_gift</para>
80+
/// <para>shared_chat_gift_paid_upgrade</para>
81+
/// <para>shared_chat_prime_paid_upgrade</para>
82+
/// <para>shared_chat_raid</para>
83+
/// <para>shared_chat_pay_it_forward</para>
84+
/// <para>shared_chat_announcement</para>
7685
/// </summary>
7786
public string NoticeType { get; set; } = string.Empty;
7887
/// <summary>
@@ -123,4 +132,66 @@ public sealed class ChannelChatNotification
123132
/// Information about the bits badge tier event. Null if notice_type is not bits_badge_tier.
124133
/// </summary>
125134
public ChannelBitsBadgeTier? BitsBadgeTier { get; set; }
135+
136+
/// <summary>
137+
/// Optional. The broadcaster user ID of the channel the message was sent from.
138+
/// </summary>
139+
public string? SourceBroadcasterUserId { get; set; }
140+
141+
/// <summary>
142+
/// Optional. The user name of the broadcaster of the channel the message was sent from.
143+
/// </summary>
144+
public string? SourceBroadcasterUserName { get; set; }
145+
146+
/// <summary>
147+
/// Optional. The login of the broadcaster of the channel the message was sent from.
148+
/// </summary>
149+
public string? SourceBroadcasterUserLogin { get; set; }
150+
151+
/// <summary>
152+
/// Optional. The UUID that identifies the source message from the channel the message was sent from.
153+
/// </summary>
154+
public string? SourceMessageId { get; set; }
155+
156+
/// <summary>
157+
/// Optional. The list of chat badges for the chatter in the channel the message was sent from.
158+
/// </summary>
159+
public ChatBadge[]? SourceBadges { get; set; }
160+
161+
/// <summary>
162+
/// Information about the sub event. Null if notice_type is not shared_chat_sub.
163+
/// </summary>
164+
public ChatSub? SharedChatSub { get; set; }
165+
/// <summary>
166+
/// Information about the resub event. Null if notice_type is not shared_chat_resub.
167+
/// </summary>
168+
public ChatResub? SharedChatResub { get; set; }
169+
/// <summary>
170+
/// Information about the gift sub event. Null if notice_type is not shared_chat_sub_gift.
171+
/// </summary>
172+
public ChatSubGift? SharedChatSubGift { get; set; }
173+
/// <summary>
174+
/// Information about the community gift sub event. Null if notice_type is not shared_chat_community_sub_gift.
175+
/// </summary>
176+
public ChatCommunitySubGift? SharedChatCommunitySubGift { get; set; }
177+
/// <summary>
178+
/// Information about the community gift paid upgrade event. Null if notice_type is not shared_chat_gift_paid_upgrade.
179+
/// </summary>
180+
public ChatGiftPaidUpgrade? SharedChatGiftPaidUpgrade { get; set; }
181+
/// <summary>
182+
/// Information about the Prime gift paid upgrade event. Null if notice_type is not shared_chat_prime_paid_upgrade.
183+
/// </summary>
184+
public ChatPrimePaidUpgrade? SharedChatPrimePaidUpgrade { get; set; }
185+
/// <summary>
186+
/// Information about the raid event. Null if notice_type is not shared_chat_raid.
187+
/// </summary>
188+
public ChatRaid? SharedChatRaid { get; set; }
189+
/// <summary>
190+
/// Information about the pay it forward event. Null if notice_type is not shared_chat_pay_it_forward.
191+
/// </summary>
192+
public ChatPayItForward? SharedChatPayItForward { get; set; }
193+
/// <summary>
194+
/// Information about the announcement event. Null if notice_type is not shared_chat_announcement
195+
/// </summary>
196+
public ChatAnnouncement? SharedChatAnnouncement { get; set; }
126197
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using TwitchLib.EventSub.Core.Models.GuestStar;
3+
using TwitchLib.EventSub.Core.Models.SharedChat;
4+
5+
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
6+
7+
/// <summary>
8+
/// Channel GuestStar Session Begin subscription type model
9+
/// <para>Description:</para>
10+
/// <para>The channel.shared_chat.begin subscription type sends a notification when a channel becomes active in an active shared chat session.</para>
11+
/// </summary>
12+
public sealed class ChannelSharedChatSessionBegin : ChannelSharedChatSessionBase
13+
{
14+
/// <summary>
15+
/// The list of participants in the session.
16+
/// </summary>
17+
public SharedChatParticipant[] Participants { get; set; } = [];
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using TwitchLib.EventSub.Core.Models.GuestStar;
3+
using TwitchLib.EventSub.Core.Models.SharedChat;
4+
5+
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
6+
7+
/// <summary>
8+
/// Channel Shared Chat Session End subscription type model
9+
/// <para>Description:</para>
10+
/// <para>The channel.shared_chat.end subscription type sends a notification when a channel leaves a shared chat session or the session ends.</para>
11+
/// </summary>
12+
public sealed class ChannelSharedChatSessionEnd : ChannelSharedChatSessionBase
13+
{
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using TwitchLib.EventSub.Core.Models.GuestStar;
3+
using TwitchLib.EventSub.Core.Models.SharedChat;
4+
5+
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
6+
7+
/// <summary>
8+
/// Channel Shared Chat Session Update subscription type model
9+
/// <para>Description:</para>
10+
/// <para>The channel.shared_chat.update subscription type sends a notification when the active shared chat session the channel is in changes.</para>
11+
/// </summary>
12+
public sealed class ChannelSharedChatSessionUpdate : ChannelSharedChatSessionBase
13+
{
14+
/// <summary>
15+
/// The list of participants in the session.
16+
/// </summary>
17+
public SharedChatParticipant[] Participants { get; set; } = [];
18+
}

0 commit comments

Comments
 (0)