public MenuUser(IUser user, MenuBase menu, Dictionary <ulong, MenuUser> parentContainer, int timeOut = 120000) { this.user = user; currentMenu = menu; mainMenu = currentMenu; _parent = parentContainer; rateLimited = true; // Prevent user from spamming bot and being rate limited _rateTimer = new Timer(2000); _rateTimer.Start(); _rateTimer.Elapsed += EndRateLimit; // Remove self from queue when timed out _timeoutTimer = new Timer(timeOut); _timeoutTimer.Start(); _timeoutTimer.Elapsed += RemoveSelf; }
public void EnterMenu(MenuBase menu, IUser user) { try { if (UserInMenu(user)) { _users.TryGetValue(user.Id, out var usermenu); usermenu?.Dispose(); } } catch (Exception e) { PrettyPrint.WriteLine(e.Message); } // Initialize Menu and Display to User var menuUser = new MenuUser(user, menu, _users); _users.Add(user.Id, menuUser); menuUser.DisplayCurrentMenu(); }