Fixed 7tv & Twitch reconnection. Added adbreak, follow, subscription handlers for Twitch. Added multi-chat support. Added support to unsubscribe from Twitch event subs.

This commit is contained in:
Tom
2024-08-06 19:29:29 +00:00
parent 75fcb8e0f8
commit 8014c12bc5
60 changed files with 1064 additions and 672 deletions

View File

@ -0,0 +1,15 @@
namespace TwitchChatTTS.Twitch.Socket.Messages
{
public class ChannelAdBreakMessage
{
public string DurationSeconds { get; set; }
public DateTime StartedAt { get; set; }
public string IsAutomatic { get; set; }
public string BroadcasterUserId { get; set; }
public string BroadcasterUserLogin { get; set; }
public string BroadcasterUserName { get; set; }
public string RequesterUserId { get; set; }
public string RequesterUserLogin { get; set; }
public string RequesterUserName { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace TwitchChatTTS.Twitch.Socket.Messages
{
public class ChannelFollowMessage
{
public string BroadcasterUserId { get; set; }
public string BroadcasterUserLogin { get; set; }
public string BroadcasterUserName { get; set; }
public string UserId { get; set; }
public string UserLogin { get; set; }
public string UserName { get; set; }
public DateTime FollowedAt { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace TwitchChatTTS.Twitch.Socket.Messages
{
public class ChannelResubscriptionMessage : ChannelSubscriptionData
{
public TwitchChatMessageInfo Message { get; set; }
public int CumulativeMonths { get; set; }
public int StreakMonths { get; set; }
public int DurationMonths { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace TwitchChatTTS.Twitch.Socket.Messages
{
public class ChannelSubscriptionGiftMessage : ChannelSubscriptionData
{
public int Total { get; set; }
public int? CumulativeTotal { get; set; }
public bool IsAnonymous { get; set; }
}
}

View File

@ -1,17 +1,18 @@
namespace TwitchChatTTS.Twitch.Socket.Messages
{
public class ChannelSubscriptionMessage
public class ChannelSubscriptionData
{
public string UserId { get; set; }
public string UserLogin { get; set; }
public string UserName { get; set; }
public string BroadcasterUserId { get; set; }
public string BroadcasterUserLogin { get; set; }
public string BroadcasterUserName { get; set; }
public string ChatterUserId { get; set; }
public string ChatterUserLogin { get; set; }
public string ChatterUserName { get; set; }
public string Tier { get; set; }
public TwitchChatMessageInfo Message { get; set; }
public int CumulativeMonths { get; set; }
public int StreakMonths { get; set; }
public int DurationMonths { get; set; }
}
public class ChannelSubscriptionMessage : ChannelSubscriptionData
{
public bool IsGifted { get; set; }
}
}

View File

@ -6,5 +6,10 @@ namespace TwitchChatTTS.Twitch.Socket.Messages
public int Total { get; set; }
public int TotalCost { get; set; }
public int MaxTotalCost { get; set; }
public EventResponsePagination? Pagination { get; set; }
}
public class EventResponsePagination {
public string Cursor { get; set; }
}
}

View File

@ -11,7 +11,8 @@ namespace TwitchChatTTS.Twitch.Socket.Messages
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Cost { get; set; }
public EventSubscriptionMessage() {
public EventSubscriptionMessage()
{
Type = string.Empty;
Version = string.Empty;
Condition = new Dictionary<string, string>();
@ -45,7 +46,8 @@ namespace TwitchChatTTS.Twitch.Socket.Messages
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SessionId { get; }
public EventSubTransport() {
public EventSubTransport()
{
Method = string.Empty;
}

View File

@ -11,6 +11,6 @@ namespace TwitchChatTTS.Twitch.Socket.Messages
public string Id { get; set; }
public string Status { get; set; }
public DateTime CreatedAt { get; set; }
public object Event { get; set; }
public object? Event { get; set; }
}
}

View File

@ -8,7 +8,7 @@ namespace TwitchChatTTS.Twitch.Socket.Messages
public string Id { get; set; }
public string Status { get; set; }
public DateTime ConnectedAt { get; set; }
public int KeepaliveTimeoutSeconds { get; set; }
public int? KeepaliveTimeoutSeconds { get; set; }
public string? ReconnectUrl { get; set; }
public string? RecoveryUrl { get; set; }
}