private async Task <List <TwicasMessageContext> > GetInitialComments(long liveId)
        {
            var list = new List <TwicasMessageContext>();

            var(initialComments, initialRaw) = await API.GetListAll(_server, _broadcasterId, liveId, _lastCommentId, 0, 20, _cc);

            if (initialComments.Length > 0)
            {
                foreach (var lowComment in initialComments)
                {
                    if (lowComment.Type == "filtered_comment")
                    {
                        continue;
                    }
                    var internalComment = Tools.Parse(lowComment);
                    var context         = CreateMessageContext(internalComment, true);
                    list.Add(context);
                }
                //var initialDataList = LowComment2Data(initialComments, initialRaw);
                //if (initialDataList.Count > 0)
                //{
                //    InitialCommentsReceived?.Invoke(this, initialDataList);
                //}
                var lastComment = initialComments[initialComments.Length - 1];
                _lastCommentId = lastComment.Id;
            }
            return(list);
        }
        private TwicasMessageContext CreateMessageContext(LowObject.Comment lowComment, bool isInitialComment, string raw)
        {
            var  commentData = Tools.Parse(lowComment);
            var  userId      = commentData.UserId;
            bool isFirstComment;

            if (_userCommentCountDict.ContainsKey(userId))
            {
                _userCommentCountDict[userId]++;
                isFirstComment = false;
            }
            else
            {
                _userCommentCountDict.AddOrUpdate(userId, 1, (s, n) => n);
                isFirstComment = true;
            }
            var user = GetUser(userId);

            var message = new TwicasComment(raw)
            {
                CommentItems = commentData.Message,
                Id           = commentData.Id.ToString(),
                NameItems    = new List <IMessagePart> {
                    MessagePartFactory.CreateMessageText(commentData.Name)
                },
                PostTime = commentData.Date.ToString("HH:mm:ss"),
                UserId   = commentData.UserId,
                UserIcon = new MessageImage
                {
                    Url    = commentData.ThumbnailUrl,
                    Alt    = null,
                    Height = commentData.ThumbnailHeight,
                    Width  = commentData.ThumbnailWidth,
                },
            };
            var metadata = new MessageMetadata(message, _options, _siteOptions, user, _cp, isFirstComment)
            {
                IsInitialComment = isInitialComment,
                SiteContextGuid  = SiteContextGuid,
            };
            var methods        = new TwicasMessageMethods();
            var messageContext = new TwicasMessageContext(message, metadata, methods);

            return(messageContext);
        }
        private List <ICommentData> LowComment2Data(IEnumerable <LowObject.Comment> lows, string raw)
        {
            var initialDataList = new List <ICommentData>();

            foreach (var c in lows)
            {
                if (string.IsNullOrEmpty(c.uid))
                {
                    continue;
                }
                try
                {
                    var data = Tools.Parse(c);
                    initialDataList.Add(data);
                }
                catch (Exception ex)
                {
                    _logger.LogException(ex);
                }
            }
            return(initialDataList);
        }