示例#1
0
        private void ParseChatMessage(WS.ChatData data)
        {
            var combinedText = string.Concat(data.Messages.Message.Select(x => x.Text));

            var isWhisper = false;

            if (data.Messages?.Meta != null)
            {
                isWhisper = data.Messages.Meta.Whisper.GetValueOrDefault();
            }

            _fireEvent(nameof(MixerService.ChatMessage), new ChatMessageEventArgs {
                ServiceName = MixerService.SERVICE_NAME,
                ChannelId   = data.Channel,
                UserId      = data.UserId,
                UserName    = data.UserName,
                IsWhisper   = isWhisper,
                IsModerator = data.UserRoles.Contains("Mod"),
                IsOwner     = data.UserRoles.Contains("Owner"),
                Message     = combinedText,
                Properties  =
                {
                    { "AvatarUrl",      data.UserAvatar ?? string.Empty },
                    { "MixerUserLevel", data.UserLevel                  },
                    { "MixerRoles",     data.UserRoles.ToArray()        }
                }
            });
        }
示例#2
0
        private void ParseChatMessage(WS.ChatData data)
        {
            var combinedText = string.Concat(data.Messages.Message.Select(x => x.Text));

            var isWhisper = false;

            if (data.Messages?.Meta != null)
            {
                isWhisper = data.Messages.Meta.Whisper.GetValueOrDefault();
            }

            _fireEvent(nameof(MixerClientInternal.ChatMessage), new ChatMessageEventArgs {
                ChannelId   = data.Channel,
                UserId      = data.UserId,
                UserName    = data.UserName,
                IsWhisper   = isWhisper,
                IsModerator = data.UserRoles.Contains("Mod"),
                IsOwner     = data.UserRoles.Contains("Owner"),
                Message     = combinedText,
                Avatar      = data.UserAvatar ?? string.Empty,
                Roles       = data.UserRoles.ToArray(),
                UserLevel   = data.UserLevel
            });
        }