Skip to content

Commit

Permalink
Added Chat Subscription Types
Browse files Browse the repository at this point in the history
  • Loading branch information
Syzuna committed Nov 18, 2023
1 parent f9c81c7 commit 9e613bd
Show file tree
Hide file tree
Showing 24 changed files with 659 additions and 0 deletions.
5 changes: 5 additions & 0 deletions TwitchLib.EventSub.Core/Models/Charity/CharityAmount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ public sealed class CharityAmount
/// <para>value / 10^decimal_places</para>
/// </summary>
public int DecimalPlaces { get; set; }

/// <summary>
/// The ISO-4217 three-letter currency code that identifies the type of currency in value.
/// </summary>
public string Currency { get; set; } = string.Empty;
}
}
13 changes: 13 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChannelBitsBadgeTier.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the bits badge tier event. Null if notice_type is not bits_badge_tier.
/// </summary>
public sealed class ChannelBitsBadgeTier
{
/// <summary>
/// The tier of the Bits badge the user just earned. For example, 100, 1000, or 10000.
/// </summary>
public int Tier { get; set; }
}
}
13 changes: 13 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatAnnouncement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the announcement event. Null if notice_type is not announcement
/// </summary>
public sealed class ChatAnnouncement
{
/// <summary>
/// Color of the announcement.
/// </summary>
public string Color { get; set; } = string.Empty;
}
}
21 changes: 21 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatBadge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Represents a chat badge of a user
/// </summary>
public sealed class ChatBadge
{
/// <summary>
/// An ID that identifies this set of chat badges. For example, Bits or Subscriber.
/// </summary>
public string SetId { get; set; } = string.Empty;
/// <summary>
/// An ID that identifies this version of the badge. The ID can be any value. For example, for Bits, the ID is the Bits tier level, but for World of Warcraft, it could be Alliance or Horde.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// Contains metadata related to the chat badges in the badges tag. Currently, this tag contains metadata only for subscriber badges, to indicate the number of months the user has been a subscriber.
/// </summary>
public string Info { get; set; } = string.Empty;
}
}
17 changes: 17 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatCharityDonation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using TwitchLib.EventSub.Core.Models.Charity;

namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the charity donation event. Null if notice_type is not charity_donation.
/// </summary>
public sealed class ChatCharityDonation
{
/// <summary>
/// Name of the charity.
/// </summary>
public string Name { get; set; } = string.Empty;

public CharityAmount Amount { get; set; } = new CharityAmount();
}
}
21 changes: 21 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatCheermote.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Optional. Metadata pertaining to the cheermote.
/// </summary>
public sealed class ChatCheermote
{
/// <summary>
/// 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}. For example, if the prefix is “Cheer” and you want to cheer 100 Bits, the full Cheermote string is Cheer100. When the Cheermote string is entered in chat, Twitch converts it to the image associated with the Bits tier that was cheered.
/// </summary>
public string Prefix { get; set; } = string.Empty;
/// <summary>
/// The amount of bits cheered.
/// </summary>
public int Bits { get; set; }
/// <summary>
/// The tier level of the cheermote.
/// </summary>
public int Tier { get; set; }
}
}
24 changes: 24 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatCommunitySubGift.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the community gift sub event. Null if notice_type is not community_sub_gift.
/// </summary>
public sealed class ChatCommunitySubGift
{
/// <summary>
/// The ID of the associated community gift.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// The type of subscription plan being used. Possible values are:
/// <para>1000 — First level of paid subscription</para>
/// <para>2000 — Second level of paid subscription</para>
/// <para>3000 — Third level of paid subscription</para>
/// </summary>
public string SubTier { get; set; } = string.Empty;
/// <summary>
/// Optional. The amount of gifts the gifter has given in this channel. Null if anonymous.
/// </summary>
public int? CumulativeTotal { get; set; }
}
}
29 changes: 29 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatEmote.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Optional. Metadata pertaining to the emote.
/// </summary>
public sealed class ChatEmote
{
/// <summary>
/// An ID that uniquely identifies this emote.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// An ID that identifies the emote set that the emote belongs to.
/// </summary>
public string EmoteSetId { get; set; } = string.Empty;
/// <summary>
/// The ID of the broadcaster who owns the emote.
/// </summary>
public string OwnerId { get; set; } = string.Empty;
/// <summary>
/// The formats that the emote is available in. For example, if the emote is available only as a static PNG, the array contains only static. But if the emote is available as a static PNG and an animated GIF, the array contains static and animated. The possible formats are:
/// <para>animated — An animated GIF is available for this emote.</para>
/// <para>static — A static PNG file is available for this emote.</para>
/// </summary>
public string[] Format { get; set; } = Array.Empty<string>();
}
}
25 changes: 25 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatGiftPaidUpgrade.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the community gift paid upgrade event. Null if notice_type is not gift_paid_upgrade.
/// </summary>
public sealed class ChatGiftPaidUpgrade
{
/// <summary>
/// Whether the gift was given anonymously.
/// </summary>
public bool GifterIsAnonymous { get; set; }
/// <summary>
/// Optional. The user ID of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserId { get; set; }
/// <summary>
/// Optional. The user name of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserName { get; set; }
/// <summary>
/// Optional. The user login of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserLogin { get; set; }
}
}
21 changes: 21 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatMention.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Optional. Metadata pertaining to the mention.
/// </summary>
public sealed class ChatMention
{
/// <summary>
/// The user ID of the mentioned user.
/// </summary>
public string UserId { get; set; } = string.Empty;
/// <summary>
/// The user name of the mentioned user.
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// The user login of the mentioned user.
/// </summary>
public string UserLogin { get; set; } = string.Empty;
}
}
19 changes: 19 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;

namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Represents a chat message
/// </summary>
public sealed class ChatMessage
{
/// <summary>
/// The chat message in plain text.
/// </summary>
public string Text { get; set; } = string.Empty;
/// <summary>
/// Ordered list of chat message fragments.
/// </summary>
public ChatMessageFragment[] Fragments { get; set; } = Array.Empty<ChatMessageFragment>();
}
}
30 changes: 30 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatMessageFragment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// A Fragment of a chat message that holds additional information
/// </summary>
public sealed class ChatMessageFragment
{
/// <summary>
/// The type of message fragment. Possible values:
/// <para>text</para>
/// <para>cheermote</para>
/// <para>emote</para>
/// <para>mention</para>
/// </summary>
public string Type { get; set; } = string.Empty;
/// <summary>
/// Message text in fragment
/// </summary>
public string Text { get; set; } = string.Empty;
public ChatCheermote? Cheermote { get; set; }
/// <summary>
/// Optional. Metadata pertaining to the emote.
/// </summary>
public ChatEmote? Emote { get; set; }
/// <summary>
/// Optional. Metadata pertaining to the mention.
/// </summary>
public ChatMention? Mention { get; set; }
}
}
25 changes: 25 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatPayItForward.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the pay it forward event. Null if notice_type is not pay_it_forward.
/// </summary>
public sealed class ChatPayItForward
{
/// <summary>
/// Whether the gift was given anonymously.
/// </summary>
public bool GifterIsAnonymous { get; set; }
/// <summary>
/// Optional. The user ID of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserId { get; set; }
/// <summary>
/// Optional. The user name of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserName { get; set; }
/// <summary>
/// Optional. The user login of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserLogin { get; set; }
}
}
16 changes: 16 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatPrimePaidUpgrade.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the Prime gift paid upgrade event. Null if notice_type is not prime_paid_upgrade.
/// </summary>
public sealed class ChatPrimePaidUpgrade
{
/// <summary>
/// The type of subscription plan being used. Possible values are:
/// <para>1000 — First level of paid subscription</para>
/// <para>2000 — Second level of paid subscription</para>
/// <para>3000 — Third level of paid subscription</para>
/// </summary>
public string SubTier { get; set; } = string.Empty;
}
}
31 changes: 31 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatRaid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;

namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the raid event. Null if notice_type is not raid.
/// </summary>
public sealed class ChatRaid
{
/// <summary>
/// The user ID of the broadcaster raiding this channel.
/// </summary>
public string UserId { get; set; } = string.Empty;
/// <summary>
/// The user name of the broadcaster raiding this channel.
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// The login name of the broadcaster raiding this channel.
/// </summary>
public string UserLogin { get; set; } = string.Empty;
/// <summary>
/// The number of viewers raiding this channel from the broadcaster’s channel.
/// </summary>
public int ViewerCount { get; set; }
/// <summary>
/// Profile image URL of the broadcaster raiding this channel.
/// </summary>
public string ProfileImageUrl { get; set; } = string.Empty;
}
}
52 changes: 52 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatResub.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace TwitchLib.EventSub.Core.Models.Chat
{
/// <summary>
/// Information about the resub event. Null if notice_type is not resub.
/// </summary>
public sealed class ChatResub
{
/// <summary>
/// The total number of months the user has subscribed.
/// </summary>
public int CumulativeMonths { get; set; }
/// <summary>
/// The number of months the subscription is for.
/// </summary>
public int DurationMonths { get; set; }
/// <summary>
/// Optional. The number of consecutive months the user has subscribed.
/// </summary>
public int? StreakMonths { get; set; }
/// <summary>
/// The type of subscription plan being used. Possible values are:
/// <para>1000 — First level of paid subscription</para>
/// <para>2000 — Second level of paid subscription</para>
/// <para>3000 — Third level of paid subscription</para>
/// </summary>
public string SubTier { get; set; } = string.Empty;
/// <summary>
/// Indicates if the resub was obtained through Amazon Prime.
/// </summary>
public bool IsPrime { get; set; }
/// <summary>
/// Whether or not the resub was a result of a gift.
/// </summary>
public bool IsGift { get; set; }
/// <summary>
/// Optional. Whether or not the gift was anonymous.
/// </summary>
public bool? GifterIsAnonymous { get; set; }
/// <summary>
/// Optional. The user ID of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserId { get; set; }
/// <summary>
/// Optional. The user name of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserName { get; set; }
/// <summary>
/// Optional. The user login of the user who gifted the subscription. Null if anonymous.
/// </summary>
public string? GifterUserLogin { get; set; }
}
}
Loading

0 comments on commit 9e613bd

Please sign in to comment.