public void ProcessData(UserCurrencyViewModel currency, UserCurrencyViewModel rank) { this.Requirements = new RequirementViewModel(); if (this.Cooldown > 0) { this.Requirements.Cooldown = new CooldownRequirementViewModel(CooldownTypeEnum.Individual, this.Cooldown); } if (!string.IsNullOrEmpty(this.Permission)) { switch (this.Permission) { case "Subscriber": this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.Subscriber); break; case "Moderator": this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.Mod); break; case "Editor": this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.ChannelEditor); break; case "Min_Points": this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.User); if (!string.IsNullOrEmpty(this.PermInfo) && int.TryParse(this.PermInfo, out int cost)) { this.Requirements.Currency = new CurrencyRequirementViewModel(currency, cost); } break; case "Min_Rank": this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.User); if (!string.IsNullOrEmpty(this.PermInfo)) { UserRankViewModel minRank = rank.Ranks.FirstOrDefault(r => r.Name.ToLower().Equals(this.PermInfo.ToLower())); if (rank != null) { this.Requirements.Rank = new CurrencyRequirementViewModel(rank, minRank); } } break; default: this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.User); break; } } this.Response = SpecialIdentifierStringBuilder.ConvertStreamlabsChatBotText(this.Response); int readCount = 1; this.Response = this.GetRegexEntries(this.Response, ReadLineRegexHeaderPattern, (string entry) => { string si = "read" + readCount; this.Actions.Add(new FileAction(FileActionTypeEnum.ReadFromFile, si, entry)); readCount++; return("$" + si); }); this.Response = this.GetRegexEntries(this.Response, ReadRandomLineRegexHeaderPattern, (string entry) => { string si = "read" + readCount; this.Actions.Add(new FileAction(FileActionTypeEnum.ReadRandomLineFromFile, si, entry)); readCount++; return("$" + si); }); this.Response = this.GetRegexEntries(this.Response, ReadRandomLineRegexHeaderPattern, (string entry) => { string si = "read" + readCount; string[] splits = entry.Split(new char[] { ',' }); FileAction action = new FileAction(FileActionTypeEnum.ReadSpecificLineFromFile, si, splits[0]); action.LineIndexToRead = splits[1]; this.Actions.Add(action); readCount++; return("$" + si); }); int webRequestCount = 1; this.Response = this.GetRegexEntries(this.Response, ReadAPIRegexHeaderPattern, (string entry) => { string si = "webrequest" + webRequestCount; this.Actions.Add(WebRequestAction.CreateForSpecialIdentifier(entry, si)); webRequestCount++; return("$" + si); }); this.Response = this.GetRegexEntries(this.Response, SaveToFileRegexHeaderPattern, (string entry) => { string[] splits = entry.Split(new char[] { ',' }); FileAction action = new FileAction(FileActionTypeEnum.AppendToFile, splits[1], splits[0]); action.LineIndexToRead = splits[1]; this.Actions.Add(action); return(string.Empty); }); this.Response = this.GetRegexEntries(this.Response, OverwriteFileRegexHeaderPattern, (string entry) => { string[] splits = entry.Split(new char[] { ',' }); FileAction action = new FileAction(FileActionTypeEnum.SaveToFile, splits[1], splits[0]); action.LineIndexToRead = splits[1]; this.Actions.Add(action); return(string.Empty); }); ChatAction chat = new ChatAction(this.Response); if (!string.IsNullOrEmpty(this.Usage) && this.Usage.Equals("SW")) { chat.IsWhisper = true; } this.Actions.Add(chat); }