Skip to content

Commit

Permalink
Merge pull request #28 from djinnet/AddChannelPointsAutomaticRewardRe…
Browse files Browse the repository at this point in the history
…demptionAddEventClasses

Add Channel Points Automatic Reward Redemption Add classes
  • Loading branch information
swiftyspiffy authored May 15, 2024
2 parents aa327f7 + 4f9eb0e commit 5c56f4a
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace TwitchLib.EventSub.Core.Models.ChannelPoints;

/// <summary>
/// Basic information about the reward that was automatically redeemed, at the time it was redeemed.
/// </summary>
public sealed class AutomaticRedemptionReward
{
/// <summary>
/// The type of reward. One of:
/// ssingle_message_bypass_sub_mode
/// send_highlighted_message
/// random_sub_emote_unlock
/// chosen_sub_emote_unlock
/// chosen_modified_sub_emote_unlock
/// </summary>
public string Type { get; set; } = string.Empty;
/// <summary>
/// The reward cost.
/// </summary>
public int Cost { get; set; }
/// <summary>
/// Optional. Emote that was unlocked.
/// </summary>
public UnlockedEmote? UnlockedEmote { get; set; }
}
16 changes: 16 additions & 0 deletions TwitchLib.EventSub.Core/Models/ChannelPoints/UnlockedEmote.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace TwitchLib.EventSub.Core.Models.ChannelPoints;

/// <summary>
/// Represents a unlocked emote
/// </summary>
public sealed class UnlockedEmote
{
/// <summary>
/// The emote ID.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// The human readable emote token.
/// </summary>
public string Name { get; set; } = string.Empty;
}
20 changes: 20 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatMessageEmoteFragment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace TwitchLib.EventSub.Core.Models.Chat;

/// <summary>
/// A Fragment of a emote that holds additional information
/// </summary>
public sealed class ChatMessageEmoteFragment
{
/// <summary>
/// The emote ID.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// The index of where the Emote starts in the text.
/// </summary>
public int Begin { get; set; }
/// <summary>
/// The index of where the Emote ends in the text.
/// </summary>
public int End { get; set; }
}
16 changes: 16 additions & 0 deletions TwitchLib.EventSub.Core/Models/Chat/ChatMessageEmotes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace TwitchLib.EventSub.Core.Models.Chat;

/// <summary>
/// Represents a chat message with emotes fragments
/// </summary>
public sealed class ChatMessageEmotes
{
/// <summary>
/// The text of the chat message.
/// </summary>
public string Text { get; set; } = string.Empty;
/// <summary>
/// An array that includes the emote ID and start and end positions for where the emote appears in the text.
/// </summary>
public ChatMessageEmoteFragment[] Emotes { get; set; } = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class ChannelAdBreakBegin
/// <summary>
/// Length in seconds of the mid-roll ad break requested
/// </summary>
public int LengthSeconds { get; set; }
public int DurationSeconds { get; set; }
/// <summary>
/// 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.
/// </summary>
Expand Down Expand Up @@ -45,4 +45,4 @@ public sealed class ChannelAdBreakBegin
/// The display name of the user that requested the ad.
/// </summary>
public string RequesterUserName { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using TwitchLib.EventSub.Core.Models.ChannelPoints;
using TwitchLib.EventSub.Core.Models.Chat;

namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;

/// <summary>
/// Channel Points Automatic Reward Redemption subscription type model
/// <para>!! The same for all channel points redemption subscription types !!</para>
/// <para>Description:</para>
/// <para>A viewer has redeemed an automatic channel points reward on the specified channel.</para>
/// <para>A redemption of a channel points automatic reward has been updated for the specified channel.</para>
/// </summary>
public sealed class ChannelPointsAutomaticRewardRedemption
{
/// <summary>
/// The ID of the Redemption.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// The ID of the channel where the reward was redeemed.
/// </summary>
public string BroadcasterUserId { get; set; } = string.Empty;

/// <summary>
/// The login of the channel where the reward was redeemed.
/// </summary>
public string BroadcasterUserLogin { get; set; } = string.Empty;
/// <summary>
/// The display name of the channel where the reward was redeemed.
/// </summary>
public string BroadcasterUserName { get; set; } = string.Empty;
/// <summary>
/// The ID of the redeeming user.
/// </summary>
public string UserId { get; set; } = string.Empty;
/// <summary>
/// Display name of the user that redeemed the reward.
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// Login of the user that redeemed the reward.
/// </summary>
public string UserLogin { get; set; } = string.Empty;
/// <summary>
/// The user input provided. Empty string if not provided.
/// </summary>
public string UserInput { get; set; } = string.Empty;
/// <summary>
/// An object that contains the user message and emote information needed to recreate the message.
/// </summary>
public ChatMessageEmotes Message { get; set; } = new();
/// <summary>
/// Basic information about the reward that was redeemed, at the time it was redeemed.
/// </summary>
public AutomaticRedemptionReward Reward { get; set; } = new();
/// <summary>
/// RFC3339 timestamp of when the reward was redeemed.
/// </summary>
public DateTimeOffset RedeemedAt { get; set; } = DateTimeOffset.MinValue;
}

0 comments on commit 5c56f4a

Please sign in to comment.