Пример #1
0
 private async void PubSub_OnWhisperReceived(object sender, PubSubWhisperEventModel packet)
 {
     if (!string.IsNullOrEmpty(packet.body))
     {
         UserViewModel user = ChannelSession.Services.User.GetUserByTwitchID(packet.from_id.ToString());
         await ChannelSession.Services.Chat.AddMessage(new TwitchChatMessageViewModel(packet, user));
     }
 }
Пример #2
0
        public UserViewModel(PubSubWhisperEventModel whisper)
        {
            this.SetUserData(twitchID: whisper.from_id.ToString());

            this.TwitchID          = whisper.from_id.ToString();
            this.TwitchUsername    = whisper.tags.login;
            this.TwitchDisplayName = (!string.IsNullOrEmpty(whisper.tags.display_name)) ? whisper.tags.display_name : this.TwitchUsername;

            this.SetTwitchRoles();
        }
Пример #3
0
        public TwitchChatMessageViewModel(PubSubWhisperEventModel whisper, UserViewModel user, UserViewModel recipient)
            : base(whisper.message_id, StreamingPlatformTypeEnum.Twitch, user)
        {
            this.WhisperThreadID = whisper.thread_id;

            this.WhisperRecipient = recipient;
            this.TargetUsername   = recipient.Username;

            this.ProcessMessageContents(whisper.body);
        }
Пример #4
0
        public static async Task <UserViewModel> Create(PubSubWhisperEventModel whisper)
        {
            UserViewModel user = await UserViewModel.Create(StreamingPlatformTypeEnum.Twitch, whisper.from_id.ToString());

            user.TwitchID          = whisper.from_id.ToString();
            user.TwitchUsername    = whisper.tags.login;
            user.TwitchDisplayName = (!string.IsNullOrEmpty(whisper.tags.display_name)) ? whisper.tags.display_name : user.TwitchUsername;

            user.SetTwitchRoles();

            ChannelSession.Settings.SetUserData(user.Data);

            return(user);
        }
Пример #5
0
        private async void PubSub_OnWhisperReceived(object sender, PubSubWhisperEventModel packet)
        {
            if (!string.IsNullOrEmpty(packet.body))
            {
                UserViewModel user = ChannelSession.Services.User.GetActiveUserByPlatformID(StreamingPlatformTypeEnum.Twitch, packet.from_id.ToString());
                if (user == null)
                {
                    user = await UserViewModel.Create(packet);
                }

                UserViewModel recipient = ChannelSession.Services.User.GetActiveUserByPlatformID(StreamingPlatformTypeEnum.Twitch, packet.recipient.id.ToString());
                if (recipient == null)
                {
                    recipient = await UserViewModel.Create(packet.recipient);
                }

                await ChannelSession.Services.Chat.AddMessage(new TwitchChatMessageViewModel(packet, user, recipient));
            }
        }
Пример #6
0
 private static void PubSub_OnWhisperReceived(object sender, PubSubWhisperEventModel whisper)
 {
     System.Console.WriteLine("WHISPER: " + whisper.body);
 }