diff --git a/TwitchIrcClient/IRC/IrcConnection.cs b/TwitchIrcClient/IRC/IrcConnection.cs
index 3ae086f..34f7af4 100644
--- a/TwitchIrcClient/IRC/IrcConnection.cs
+++ b/TwitchIrcClient/IRC/IrcConnection.cs
@@ -13,7 +13,6 @@ using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using TwitchIrcClient.IRC.Messages;
-using TwitchIrcClient.IRC.Messages;
namespace TwitchIrcClient.IRC
{
diff --git a/TwitchIrcClient/IRC/Messages/Privmsg.cs b/TwitchIrcClient/IRC/Messages/Privmsg.cs
index 5fcf219..eb2d3de 100644
--- a/TwitchIrcClient/IRC/Messages/Privmsg.cs
+++ b/TwitchIrcClient/IRC/Messages/Privmsg.cs
@@ -14,6 +14,27 @@ namespace TwitchIrcClient.IRC.Messages
///
public class Privmsg : ReceivedMessage
{
+ ///
+ /// 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.
+ ///
+ public IEnumerable BadgeInfo => TryGetTag("badge-info").Split(',');
+ ///
+ /// Contains the total number of months the user has subscribed, even if they aren't
+ /// subscribed currently.
+ ///
+ 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;
+ }
+ }
///
/// 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