mirror of
https://github.com/Ikatono/TwitchIrcClient.git
synced 2025-10-29 04:56:12 -05:00
minor updates to IRC
This commit is contained in:
@@ -13,7 +13,6 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using TwitchIrcClient.IRC.Messages;
|
using TwitchIrcClient.IRC.Messages;
|
||||||
using TwitchIrcClient.IRC.Messages;
|
|
||||||
|
|
||||||
namespace TwitchIrcClient.IRC
|
namespace TwitchIrcClient.IRC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,27 @@ namespace TwitchIrcClient.IRC.Messages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Privmsg : ReceivedMessage
|
public class Privmsg : ReceivedMessage
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains metadata related to the chat badges in the badges tag.
|
||||||
|
/// According to Twitch's documentation this should only include info about
|
||||||
|
/// subscription length, but it also contains prediction info and who knows what else.
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<string> BadgeInfo => TryGetTag("badge-info").Split(',');
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the total number of months the user has subscribed, even if they aren't
|
||||||
|
/// subscribed currently.
|
||||||
|
/// </summary>
|
||||||
|
public int SubscriptionLength
|
||||||
|
{ get
|
||||||
|
{
|
||||||
|
//TODO redo this, functional style clearly didn't work here
|
||||||
|
if (int.TryParse((BadgeInfo.FirstOrDefault(
|
||||||
|
b => b.StartsWith("SUBSCRIBER", StringComparison.CurrentCultureIgnoreCase)) ?? "")
|
||||||
|
.Split("/", 2).ElementAtOrDefault(1) ?? "", out int value))
|
||||||
|
return value;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of chat badges. Most badges have only 1 version, but some badges like
|
/// List of chat badges. Most badges have only 1 version, but some badges like
|
||||||
/// subscriber badges offer different versions of the badge depending on how
|
/// subscriber badges offer different versions of the badge depending on how
|
||||||
|
|||||||
Reference in New Issue
Block a user