private string ProcessSongRequest(ParseState state) { if (!RequestBot.HasPermission(state.user, RequestBotConfig.Instance.SongRequestPermissionLevel)) { QueueChatMessage(RequestBotConfig.Instance.PermissionLevelNotAcceptedText); return(success); } try { if (RequestBotConfig.Instance.RequestQueueOpen == false && !state.flags.HasFlag(CmdFlags.NoFilter) && !state.flags.HasFlag(CmdFlags.Local)) // BUG: Complex permission, Queue state message needs to be handled higher up { QueueChatMessage($"Queue is currently closed."); return(success); } if (!RequestTracker.ContainsKey(state.user.Id)) { RequestTracker.Add(state.user.Id, new RequestUserTracker()); } int limit = RequestBotConfig.Instance.UserRequestLimit; if (state.user.IsSubscriber) { limit = Math.Max(limit, RequestBotConfig.Instance.SubRequestLimit); } if (state.user.IsModerator) { limit = Math.Max(limit, RequestBotConfig.Instance.ModRequestLimit); } if (state.user.IsVip) { limit += RequestBotConfig.Instance.VipBonusRequests; // Current idea is to give VIP's a bonus over their base subscription class, you can set this to 0 if you like } if (!state.user.IsBroadcaster) { if (RequestTracker[state.user.Id].numRequests >= limit) { if (RequestBotConfig.Instance.LimitUserRequestsToSession) { new DynamicText().Add("Requests", RequestTracker[state.user.Id].numRequests.ToString()).Add("RequestLimit", RequestBotConfig.Instance.SubRequestLimit.ToString()).QueueMessage("You've already used %Requests% requests this stream. Subscribers are limited to %RequestLimit%."); } else { new DynamicText().Add("Requests", RequestTracker[state.user.Id].numRequests.ToString()).Add("RequestLimit", RequestBotConfig.Instance.SubRequestLimit.ToString()).QueueMessage("You already have %Requests% on the queue. You can add another once one is played. Subscribers are limited to %RequestLimit%."); } return(success); } } // BUG: Need to clean up the new request pipeline string testrequest = normalize.RemoveSymbols(ref state.parameter, normalize._SymbolsNoDash); RequestInfo newRequest = new RequestInfo(state.user, state.parameter, DateTime.UtcNow, _digitRegex.IsMatch(testrequest) || _beatSaverRegex.IsMatch(testrequest), state, state.flags, state.info); if (!newRequest.isBeatSaverId && state.parameter.Length < 2) { QueueChatMessage($"Request \"{state.parameter}\" is too short- Beat Saver searches must be at least 3 characters!"); } if (!UnverifiedRequestQueue.Contains(newRequest)) { UnverifiedRequestQueue.Enqueue(newRequest); } } catch (Exception ex) { Plugin.Log(ex.ToString()); } return(success); }