public YouTubeLiveMessageMetadata(IYouTubeLiveMessage message, ICommentOptions options, IYouTubeLiveSiteOptions siteOptions, IUser user, ICommentProvider cp, bool isFirstComment)
        {
            _options        = options;
            _siteOptions    = siteOptions;
            User            = user;
            CommentProvider = cp;
            _isFirstComment = isFirstComment;

            options.PropertyChanged += Options_PropertyChanged;
        }
        public YouTubeLiveCommentViewModel(ICommentOptions options, IYouTubeLiveSiteOptions siteOptions, CommentData commentData, ICommentProvider commentProvider, bool isFirstComment, IUser user)
            : base(options, user, commentProvider, isFirstComment)
        {
            var messageText = commentData.MessageItems.ToText();

            IsPaidMessage = commentData.IsPaidMessage;
            if (siteOptions.IsAutoSetNickname)
            {
                var nick = ExtractNickname(messageText);
                if (!string.IsNullOrEmpty(nick))
                {
                    user.Nickname = nick;
                }
            }
            NameItemsInternal = commentData.NameItems;
            user.Name         = commentData.NameItems;
            if (commentData.IsPaidMessage)
            {
                var list = new List <IMessagePart>();
                var s    = commentData.PurchaseAmount;
                if (commentData.MessageItems.Count > 0)
                {
                    s += Environment.NewLine;
                }
                list.Add(MessagePartFactory.CreateMessageText(s));
                list.AddRange(commentData.MessageItems);
                MessageItems = list;
                MessageType  = MessageType.BroadcastInfo;
            }
            else
            {
                MessageItems = commentData.MessageItems;
                MessageType  = MessageType.Comment;
            }
            Id           = commentData.Id;
            UserId       = commentData.UserId;
            Thumbnail    = commentData.Thumbnail;
            PostTime     = Tools.ParseTimestampUsec(commentData.TimestampUsec).ToLocalTime().ToString("HH:mm:ss");
            _siteOptions = siteOptions;

            Init();
        }
 public ChatProvider2(IYouTubeLiveSiteOptions siteOptions, ILogger logger)
 {
     _siteOptions = siteOptions;
     _logger      = logger;
 }
Esempio n. 4
0
 public ChatProvider2(IYouTubeLiveSiteOptions siteOptions)
 {
     _siteOptions = siteOptions;
 }