Ejemplo n.º 1
0
 public UserDataModel GetUserDataByUsername(StreamingPlatformTypeEnum platform, string username)
 {
     if (!string.IsNullOrEmpty(username))
     {
         if (platform == StreamingPlatformTypeEnum.All)
         {
             foreach (StreamingPlatformTypeEnum p in StreamingPlatforms.Platforms)
             {
                 UserDataModel userData = this.GetUserDataByUsername(p, username);
                 if (userData != null)
                 {
                     return(userData);
                 }
             }
         }
         else
         {
             lock (this.UserData)
             {
                 if (this.UsernameLookups.ContainsKey(platform) && this.UsernameLookups[platform].ContainsKey(username.ToLowerInvariant()))
                 {
                     Guid id = this.UsernameLookups[platform][username.ToLowerInvariant()];
                     if (this.UserData.ContainsKey(id))
                     {
                         return(this.UserData[id]);
                     }
                 }
             }
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
        public async Task <UserDataModel> GetUserDataByPlatformUsername(StreamingPlatformTypeEnum platform, string platformUsername)
        {
            if (string.IsNullOrEmpty(platformUsername) || platform == StreamingPlatformTypeEnum.None || platform == StreamingPlatformTypeEnum.All)
            {
                return(null);
            }

            if (this.platformUsernameLookups[platform].TryGetValue(platformUsername, out Guid id) && this.UserData.TryGetValue(id, out UserDataModel userData))
            {
                return(userData);
            }

            string columnName = null;

            switch (platform)
            {
            case StreamingPlatformTypeEnum.Twitch: columnName = "TwitchUsername"; break;
            }

            userData = null;
            if (!string.IsNullOrEmpty(columnName))
            {
                await ChannelSession.Services.Database.Read(this.DatabaseFilePath, "SELECT * FROM Users WHERE " + columnName + " LIKE $PlatformUsername",
                                                            new Dictionary <string, object>() { { "$PlatformUsername", platformUsername } },
                                                            (Dictionary <string, object> data) =>
                {
                    userData = JSONSerializerHelper.DeserializeFromString <UserDataModel>(data["Data"].ToString());
                });
            }

            this.SetUserData(userData);
            return(userData);
        }
Ejemplo n.º 3
0
        public UserDonationModel ToGenericDonation()
        {
            StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.All;

            foreach (StreamingPlatformTypeEnum p in StreamingPlatforms.Platforms)
            {
                if (string.Equals(p.ToString(), this.SenderType, StringComparison.InvariantCultureIgnoreCase))
                {
                    platform = p;
                }
            }

            return(new UserDonationModel()
            {
                Source = UserDonationSourceEnum.TreatStream,

                ID = Guid.NewGuid().ToString(),
                Platform = platform,
                Username = this.Sender,
                Type = this.Title,
                Message = this.Message,

                Amount = 0,

                DateTime = DateTimeOffset.Now,
            });
        }
Ejemplo n.º 4
0
        public AlertChatMessageViewModel(StreamingPlatformTypeEnum platform, UserViewModel user, string message, string color = null)
            : base(string.Empty, platform, user)
        {
            this.Color = color;

            this.AddStringMessagePart(string.Format("--- {0} ---", message));
        }
Ejemplo n.º 5
0
 public UserViewModel GetActiveUserByUsername(string username, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.None)
 {
     if (!string.IsNullOrEmpty(username))
     {
         username = this.SanitizeUsername(username);
         if (platform == StreamingPlatformTypeEnum.None || platform == StreamingPlatformTypeEnum.All)
         {
             foreach (StreamingPlatformTypeEnum p in StreamingPlatforms.SupportedPlatforms)
             {
                 UserViewModel user = this.GetActiveUserByUsername(username, p);
                 if (user != null)
                 {
                     return(user);
                 }
             }
         }
         else
         {
             if (this.platformUsernameLookups[platform].ContainsKey(username))
             {
                 return(this.GetActiveUserByID(this.platformUsernameLookups[platform][username]));
             }
         }
     }
     return(null);
 }
        public CommandParametersModel(UserViewModel user = null, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.All, IEnumerable <string> arguments = null, Dictionary <string, string> specialIdentifiers = null)
        {
            if (user != null)
            {
                this.User = user;
            }

            if (arguments != null)
            {
                this.Arguments = new List <string>(arguments);
            }

            if (specialIdentifiers != null)
            {
                this.SpecialIdentifiers = new Dictionary <string, string>(specialIdentifiers);
            }

            if (platform != StreamingPlatformTypeEnum.None)
            {
                this.Platform = platform;
            }
            else
            {
                this.Platform = this.User.Platform;
            }
        }
Ejemplo n.º 7
0
 public StreamingPlatformStatusModel(StreamingPlatformTypeEnum platform, string title, string description, DateTimeOffset lastUpdated, string link)
 {
     this.Platform    = platform;
     this.Title       = title;
     this.Description = description;
     this.LastUpdated = lastUpdated;
     this.Link        = link;
 }
Ejemplo n.º 8
0
 public UserViewModel GetActiveUserByPlatformID(StreamingPlatformTypeEnum platform, string id)
 {
     if (!string.IsNullOrEmpty(id) && this.platformUserIDLookups[platform].ContainsKey(id))
     {
         return(this.GetActiveUserByID(this.platformUserIDLookups[platform][id]));
     }
     return(null);
 }
Ejemplo n.º 9
0
        public async Task Whisper(StreamingPlatformTypeEnum platform, string username, string message, bool sendAsStreamer = false)
        {
            UserViewModel user = ChannelSession.Services.User.GetUserByUsername(username, platform);

            if (user != null)
            {
                await this.Whisper(user, message, sendAsStreamer);
            }
        }
Ejemplo n.º 10
0
 public PixelChatSendMessageModel(string type, string username, StreamingPlatformTypeEnum platform)
     : this(type)
 {
     this.data = new JObject()
     {
         { "username", username },
         { "platform", platform.ToString().ToLower() }
     };
 }
Ejemplo n.º 11
0
        public async Task Perform(UserViewModel user, StreamingPlatformTypeEnum platform, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers)
        {
            await this.AsyncSemaphore.WaitAndRelease(async() =>
            {
                this.platform = platform;
                this.extraSpecialIdentifiers = extraSpecialIdentifiers;

                await this.PerformInternal(user, arguments);
            });
        }
 public StreamlabsChatBotDataModel(StreamingPlatformTypeEnum platform)
 {
     this.Platform = platform;
     this.Commands = new List <StreamlabsChatBotCommandModel>();
     this.Timers   = new List <StreamlabsChatBotTimerModel>();
     this.Quotes   = new List <string>();
     this.Ranks    = new List <StreamlabsChatBotRankModel>();
     this.Viewers  = new List <StreamlabsChatBotViewerModel>();
     this.Events   = new List <StreamlabsChatBotEventModel>();
 }
        public StreamlabsChatBotViewerModel(StreamingPlatformTypeEnum platform, List <string> values)
        {
            this.Platform = platform;

            this.Name = values[0];
            this.Rank = values[1];

            int.TryParse(values[2], out int points);
            this.Points = points;

            int.TryParse(values[3], out int hours);
            this.Hours = hours;
        }
Ejemplo n.º 14
0
        public async Task PerformAndWait(UserViewModel user, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.None, IEnumerable <string> arguments = null, Dictionary <string, string> extraSpecialIdentifiers = null)
        {
            try
            {
                await this.Perform(user, platform, arguments, extraSpecialIdentifiers);

                if (this.currentTaskRun != null && !this.currentTaskRun.IsCompleted)
                {
                    await this.currentTaskRun;
                }
            }
            catch (Exception ex) { Logger.Log(ex); }
        }
Ejemplo n.º 15
0
        public async Task SendMessage(string message, bool sendAsStreamer = false, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.All)
        {
            if (platform.HasFlag(StreamingPlatformTypeEnum.Twitch))
            {
                await this.TwitchChatService.SendMessage(message, sendAsStreamer);

                if (sendAsStreamer || ChannelSession.TwitchBotConnection == null)
                {
                    UserViewModel user = ChannelSession.GetCurrentUser();
                    await this.AddMessage(new TwitchChatMessageViewModel(user, message));
                }
            }
        }
Ejemplo n.º 16
0
        public async Task <UserViewModel> RemoveActiveUserByUsername(StreamingPlatformTypeEnum platform, string username)
        {
            if (!string.IsNullOrEmpty(username))
            {
                username = this.SanitizeUsername(username);
                if (this.platformUsernameLookups[platform].ContainsKey(username))
                {
                    UserViewModel user = this.GetActiveUserByID(this.platformUsernameLookups[platform][username]);
                    await this.RemoveActiveUser(user);

                    return(user);
                }
            }
            return(null);
        }
Ejemplo n.º 17
0
        public UserViewModel GetUserByUsername(string username, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.None)
        {
            UserViewModel user = null;

            if (!string.IsNullOrEmpty(username))
            {
                username = username.ToLower().Replace("@", "").Trim();
                if (platform.HasFlag(StreamingPlatformTypeEnum.Twitch) || platform == StreamingPlatformTypeEnum.None)
                {
                    if (this.usersByTwitchLogin.TryGetValue(username.ToLower(), out user))
                    {
                        return(user);
                    }
                }
            }
            return(user);
        }
Ejemplo n.º 18
0
        public UserViewModel GetUserFullSearch(StreamingPlatformTypeEnum platform, string userID, string username)
        {
            UserViewModel user = null;

            if (!string.IsNullOrEmpty(userID))
            {
                if (platform.HasFlag(StreamingPlatformTypeEnum.Twitch) && user == null)
                {
                    user = ChannelSession.Services.User.GetUserByTwitchID(userID);
                }

                if (user == null)
                {
                    UserDataModel userData = null;
                    if (platform.HasFlag(StreamingPlatformTypeEnum.Twitch) && userData == null)
                    {
                        userData = ChannelSession.Settings.GetUserDataByTwitchID(userID);
                    }

                    if (userData != null)
                    {
                        user = new UserViewModel(userData);
                    }
                }
            }

            if (user == null)
            {
                user = ChannelSession.Services.User.GetUserByUsername(username);
                if (user == null)
                {
                    UserDataModel userData = ChannelSession.Settings.GetUserDataByUsername(platform, username);
                    if (userData != null)
                    {
                        user = new UserViewModel(userData);
                    }
                    else
                    {
                        user = new UserViewModel(username);
                    }
                }
            }

            return(user);
        }
        public static async Task <UserViewModel> SearchForUser(string username, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.All)
        {
            username = username.Replace("@", "");
            UserViewModel user = ChannelSession.Services.User.GetUserByUsername(username, platform);

            if (user == null)
            {
                if (platform.HasFlag(StreamingPlatformTypeEnum.Twitch) && ChannelSession.TwitchUserConnection != null)
                {
                    Twitch.Base.Models.NewAPI.Users.UserModel twitchUser = await ChannelSession.TwitchUserConnection.GetNewAPIUserByLogin(username);

                    if (twitchUser != null)
                    {
                        user = new UserViewModel(twitchUser);
                    }
                }
            }
            return(user);
        }
Ejemplo n.º 20
0
        private static async Task <UserViewModel> Create(StreamingPlatformTypeEnum platform, string platformID)
        {
            UserDataModel data = new UserDataModel();

            if (!string.IsNullOrEmpty(platformID))
            {
                data = await ChannelSession.Settings.GetUserDataByPlatformID(platform, platformID);

                if (data == null)
                {
                    data = new UserDataModel();
                    switch (platform)
                    {
                    case StreamingPlatformTypeEnum.Twitch: data.TwitchID = platformID; break;
                    }
                    ChannelSession.Settings.SetUserData(data, newData: true);
                }
            }
            return(new UserViewModel(data));
        }
        public static async Task <StreamlabsChatBotDataModel> GatherStreamlabsChatBotSettings(StreamingPlatformTypeEnum platform, string filePath)
        {
            StreamlabsChatBotDataModel data = new StreamlabsChatBotDataModel(platform);
            await Task.Run(() =>
            {
                try
                {
                    using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read))
                    {
                        using (var reader = ExcelReaderFactory.CreateReader(stream))
                        {
                            var result = reader.AsDataSet();

                            if (result.Tables.Contains("Commands"))
                            {
                                data.AddCommands(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Commands"]));
                            }
                            if (result.Tables.Contains("Timers"))
                            {
                                data.AddTimers(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Timers"]));
                            }
                            if (result.Tables.Contains("Quotes"))
                            {
                                data.AddQuotes(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Quotes"]));
                            }
                            if (result.Tables.Contains("Extra Quotes"))
                            {
                                data.AddQuotes(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Extra Quotes"]));
                            }
                            if (result.Tables.Contains("Ranks"))
                            {
                                data.AddRanks(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Ranks"]));
                            }
                            if (result.Tables.Contains("Currency"))
                            {
                                data.AddViewers(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Currency"]));
                            }
                            if (result.Tables.Contains("Events"))
                            {
                                data.AddEvents(StreamlabsChatBotDataModel.ReadRowsFromTable(result.Tables["Events"]));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    data = null;
                }
            });

            return(data);
        }
Ejemplo n.º 22
0
        public override async Task <JObject> GetProcessedItem(UserViewModel user, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers, StreamingPlatformTypeEnum platform)
        {
            List <OverlayLeaderboardItem> items = new List <OverlayLeaderboardItem>();

            if (this.LeaderboardType == OverlayLeaderboardListItemTypeEnum.CurrencyRank)
            {
                if (ChannelSession.Settings.Currency.ContainsKey(this.CurrencyID))
                {
                    CurrencyModel currency = ChannelSession.Settings.Currency[this.CurrencyID];
                    IEnumerable <UserDataModel> userDataList = SpecialIdentifierStringBuilder.GetUserOrderedCurrencyList(currency);
                    for (int i = 0; i < userDataList.Count() && items.Count < this.TotalToShow; i++)
                    {
                        UserDataModel userData = userDataList.ElementAt(i);
                        if (!userData.IsCurrencyRankExempt)
                        {
                            items.Add(new OverlayLeaderboardItem(new UserViewModel(userData), currency.GetAmount(userData).ToString()));
                        }
                    }
                }
            }
            else if (this.LeaderboardType == OverlayLeaderboardListItemTypeEnum.Bits && this.lastQuery.TotalMinutesFromNow() > 1)
            {
                BitsLeaderboardModel bitsLeaderboard = null;
                switch (this.BitsLeaderboardDateRange)
                {
                case BitsLeaderboardPeriodEnum.Day:
                    bitsLeaderboard = await ChannelSession.TwitchUserConnection.GetBitsLeaderboard(BitsLeaderboardPeriodEnum.Day, this.TotalToShow);

                    break;

                case BitsLeaderboardPeriodEnum.Week:
                    bitsLeaderboard = await ChannelSession.TwitchUserConnection.GetBitsLeaderboard(BitsLeaderboardPeriodEnum.Week, this.TotalToShow);

                    break;

                case BitsLeaderboardPeriodEnum.Month:
                    bitsLeaderboard = await ChannelSession.TwitchUserConnection.GetBitsLeaderboard(BitsLeaderboardPeriodEnum.Month, this.TotalToShow);

                    break;

                case BitsLeaderboardPeriodEnum.Year:
                    bitsLeaderboard = await ChannelSession.TwitchUserConnection.GetBitsLeaderboard(BitsLeaderboardPeriodEnum.Year, this.TotalToShow);

                    break;

                case BitsLeaderboardPeriodEnum.All:
                    bitsLeaderboard = await ChannelSession.TwitchUserConnection.GetBitsLeaderboard(BitsLeaderboardPeriodEnum.All, this.TotalToShow);

                    break;
                }
                this.lastQuery = DateTimeOffset.Now;

                if (bitsLeaderboard != null && bitsLeaderboard.users != null)
                {
                    foreach (BitsLeaderboardUserModel bitsUser in bitsLeaderboard.users.OrderBy(u => u.rank).Take(this.TotalToShow))
                    {
                        items.Add(new OverlayLeaderboardItem(bitsUser.user_name, bitsUser.score.ToString()));
                    }
                }
            }

            if (items.Count > 0)
            {
                await this.ProcessLeaderboardItems(items);
            }

            return(await base.GetProcessedItem(user, arguments, extraSpecialIdentifiers, platform));
        }
        protected override async Task <Dictionary <string, string> > GetTemplateReplacements(UserViewModel user, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers, StreamingPlatformTypeEnum platform)
        {
            UserViewModel boss   = null;
            int           health = 0;

            await this.HealthSemaphore.WaitAndRelease(() =>
            {
                boss   = this.CurrentBoss;
                health = this.CurrentHealth;
                return(Task.FromResult(0));
            });

            Dictionary <string, string> replacementSets = new Dictionary <string, string>();

            replacementSets["BACKGROUND_COLOR"] = this.BackgroundColor;
            replacementSets["BORDER_COLOR"]     = this.BorderColor;
            replacementSets["TEXT_COLOR"]       = this.TextColor;
            replacementSets["TEXT_FONT"]        = this.TextFont;
            replacementSets["WIDTH"]            = this.Width.ToString();
            replacementSets["HEIGHT"]           = this.Height.ToString();
            replacementSets["TEXT_SIZE"]        = ((int)(0.2 * ((double)this.Height))).ToString();

            if (boss != null)
            {
                replacementSets["USERNAME"]   = boss.Username;
                replacementSets["USER_IMAGE"] = boss.AvatarLink;
            }
            replacementSets["USER_IMAGE_SIZE"] = ((int)(0.8 * ((double)this.Height))).ToString();

            replacementSets["HEALTH_REMAINING"] = health.ToString();
            replacementSets["MAXIMUM_HEALTH"]   = this.CurrentStartingHealth.ToString();

            replacementSets["PROGRESS_COLOR"] = this.ProgressColor;
            replacementSets["PROGRESS_WIDTH"] = ((((double)health) / ((double)this.CurrentStartingHealth)) * 100.0).ToString();

            return(replacementSets);
        }
Ejemplo n.º 24
0
 public StatusPageStreamingPlatformStatusService(StreamingPlatformTypeEnum platform, string statusFeedLink)
 {
     this.platform       = platform;
     this.statusFeedLink = statusFeedLink;
 }
Ejemplo n.º 25
0
        public Task Perform(UserViewModel user, StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.None, IEnumerable <string> arguments = null, Dictionary <string, string> extraSpecialIdentifiers = null)
        {
            if (this.IsEnabled)
            {
                Logger.Log(LogLevel.Debug, $"Starting command performing: {this.Name}");

                if (arguments == null)
                {
                    arguments = new List <string>();
                }

                if (extraSpecialIdentifiers == null)
                {
                    extraSpecialIdentifiers = new Dictionary <string, string>();
                }

                if (this.platform == StreamingPlatformTypeEnum.None && user != null)
                {
                    this.platform = user.Platform;
                }
                else
                {
                    this.platform = platform;
                }

                try
                {
                    if (this.StoreID != Guid.Empty)
                    {
                        if (!CommandBase.commandUses.ContainsKey(this.StoreID))
                        {
                            CommandBase.commandUses[this.StoreID] = 0;
                        }
                        CommandBase.commandUses[this.StoreID]++;
                    }
                }
                catch (Exception ex) { Logger.Log(ex); }

                this.TrackTelemetry();
                if (user != null)
                {
                    user.Data.TotalCommandsRun++;
                }

                this.OnCommandStart(this, new EventArgs());

                this.currentCancellationTokenSource = new CancellationTokenSource();
                this.currentTaskRun = Task.Run(async() =>
                {
                    bool waitOccurred = false;
                    try
                    {
                        if (!await this.PerformPreChecks(user, arguments, extraSpecialIdentifiers))
                        {
                            return;
                        }

                        if (!this.Unlocked)
                        {
                            await this.AsyncSemaphore.WaitAsync();
                            waitOccurred = true;
                        }
                        await this.PerformInternal(user, arguments, extraSpecialIdentifiers, this.currentCancellationTokenSource.Token);
                    }
                    catch (TaskCanceledException) { }
                    catch (Exception ex) { Logger.Log(ex); }
                    finally
                    {
                        if (waitOccurred)
                        {
                            this.AsyncSemaphore.Release();
                        }
                    }
                }, this.currentCancellationTokenSource.Token);
            }
            return(Task.FromResult(0));
        }
Ejemplo n.º 26
0
 public async Task Perform(StreamingPlatformTypeEnum platform = StreamingPlatformTypeEnum.None, IEnumerable <string> arguments = null, Dictionary <string, string> extraSpecialIdentifiers = null)
 {
     await this.Perform(ChannelSession.GetCurrentUser(), platform, arguments, extraSpecialIdentifiers : extraSpecialIdentifiers);
 }
Ejemplo n.º 27
0
        public StreamingPlatformAccountControlViewModel(StreamingPlatformTypeEnum platform)
        {
            this.Platform = platform;

            if (this.IsUserAccountConnected)
            {
                if (this.Platform == StreamingPlatformTypeEnum.Twitch && ChannelSession.TwitchUserNewAPI != null)
                {
                    this.UserAccountAvatar   = ChannelSession.TwitchUserNewAPI.profile_image_url;
                    this.UserAccountUsername = ChannelSession.TwitchUserNewAPI.display_name;
                }
            }
            if (this.IsBotAccountConnected)
            {
                if (this.Platform == StreamingPlatformTypeEnum.Twitch && ChannelSession.TwitchBotNewAPI != null)
                {
                    this.BotAccountAvatar   = ChannelSession.TwitchBotNewAPI.profile_image_url;
                    this.BotAccountUsername = ChannelSession.TwitchBotNewAPI.display_name;
                }
            }

            this.UserAccountCommand = this.CreateCommand(async(parameter) =>
            {
                if (this.IsUserAccountConnected)
                {
                    //if (this.Platform == StreamingPlatformTypeEnum.Mixer)
                    //{
                    //    ChannelSession.DisconnectMixerUser();
                    //}
                    //this.UserAccountAvatar = null;
                    //this.UserAccountUsername = null;
                }
                else
                {
                    Result result = new Result(false);
                    if (this.Platform == StreamingPlatformTypeEnum.Twitch)
                    {
                        result = await ChannelSession.ConnectTwitchUser();
                        if (result.Success && ChannelSession.TwitchUserNewAPI != null)
                        {
                            this.UserAccountAvatar   = ChannelSession.TwitchUserNewAPI.profile_image_url;
                            this.UserAccountUsername = ChannelSession.TwitchUserNewAPI.display_name;
                        }
                    }

                    if (!result.Success)
                    {
                        this.UserAccountAvatar   = null;
                        this.UserAccountUsername = null;

                        await DialogHelper.ShowMessage(result.Message);
                    }
                }
                this.NotifyAllProperties();
            });

            this.BotAccountCommand = this.CreateCommand(async(parameter) =>
            {
                if (this.IsBotAccountConnected)
                {
                    if (this.Platform == StreamingPlatformTypeEnum.Twitch)
                    {
                        await ChannelSession.DisconnectTwitchBot();
                        ChannelSession.Settings.StreamingPlatformAuthentications[StreamingPlatformTypeEnum.Twitch].BotOAuthToken = null;
                    }
                    this.BotAccountAvatar   = null;
                    this.BotAccountUsername = null;
                }
                else
                {
                    Result result = new Result(false);
                    if (this.Platform == StreamingPlatformTypeEnum.Twitch)
                    {
                        result = await ChannelSession.ConnectTwitchBot();
                        if (result.Success)
                        {
                            if (ChannelSession.TwitchBotNewAPI.id.Equals(ChannelSession.TwitchUserNewAPI?.id))
                            {
                                await ChannelSession.DisconnectTwitchBot();
                                result = new Result(MixItUp.Base.Resources.BotAccountMustBeDifferent);
                            }
                            else if (ChannelSession.TwitchBotNewAPI != null)
                            {
                                this.BotAccountAvatar   = ChannelSession.TwitchBotNewAPI.profile_image_url;
                                this.BotAccountUsername = ChannelSession.TwitchBotNewAPI.display_name;
                            }
                        }
                    }

                    if (!result.Success)
                    {
                        this.BotAccountAvatar   = null;
                        this.BotAccountUsername = null;

                        await DialogHelper.ShowMessage(result.Message);
                    }
                }
                this.NotifyAllProperties();
            });
        }
 protected virtual Task <Dictionary <string, string> > GetTemplateReplacements(UserViewModel user, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers, StreamingPlatformTypeEnum platform)
 {
     return(Task.FromResult(new Dictionary <string, string>()));
 }
 protected override async Task PerformReplacements(JObject jobj, UserViewModel user, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers, StreamingPlatformTypeEnum platform)
 {
     if (jobj != null && jobj.ContainsKey("HTML"))
     {
         jobj["HTML"] = this.PerformTemplateReplacements(jobj["HTML"].ToString(), await this.GetTemplateReplacements(user, arguments, extraSpecialIdentifiers, platform));
     }
     await base.PerformReplacements(jobj, user, arguments, extraSpecialIdentifiers, platform);
 }
Ejemplo n.º 30
0
 public AlertChatMessageViewModel(StreamingPlatformTypeEnum platform, string message, string color = null) : this(platform, ChannelSession.GetCurrentUser(), message, color)
 {
 }