private void ScheduleAutomatedActions(IChatClient chatClient) { _lastCallToJoin = new DelayedMessageAction(HEIST_DELAY_IN_SECONDS - 30, "Only 30 seconds left to join the heist! Type !heist to join it!", chatClient); _automatedActionSystem.AddAction(_lastCallToJoin); _startHeistAction = new OneTimeCallBackAction(HEIST_DELAY_IN_SECONDS, () => StartHeist(chatClient)); _automatedActionSystem.AddAction(_startHeistAction); }
private void CreateGameJoinWindow(IChatClient chatClient) { var joinWarning = new DelayedMessageAction(30, "You only have 30 seconds left to join the quiz game! Type \"!quiz join\" to join the game!", chatClient); _automatedActionSystem.AddAction(joinWarning); var startAskingQuestions = new OneTimeCallBackAction(60, () => StartAskingQuestions(chatClient)); _automatedActionSystem.AddAction(startAskingQuestions); }
public DuelingSystem(IChatClient chatClient, IAutomatedActionSystem automatedActionSystem) { _chatClient = chatClient; _chatClient.OnWhisperReceived += ChatClientOnOnWhisperReceived; var repeatingCallbackAction = new RepeatingCallbackAction(CheckForExpiredDuels); automatedActionSystem.AddAction(repeatingCallbackAction); }
private void ScheduleAutomatedMessages() { var messages = _repository.List <IntervalMessage>(); foreach (IntervalMessage message in messages) { _autoActionSystem.AddAction(new AutomatedMessage(message, _chatClients)); } }
private string SetVoteToEnd(IChatClient chatClient, CommandReceivedEventArgs eventArgs) { if (!_votingSystem.IsVoteActive) { return("There's no vote right now..."); } if (!eventArgs.ChatUser.IsInThisRoleOrHigher(UserRole.Mod)) { return("You don't have permission to end the voting..."); } string delayArg = eventArgs.Arguments.ElementAtOrDefault(1); if (string.IsNullOrWhiteSpace(delayArg)) { return(_votingSystem.EndVoting()); } int secondsDelay = GetSecondsDelay(delayArg); if (secondsDelay <= 0) { return("Invalid delay specified"); } if (_endVoteCallback == null) { _endVoteCallback = new DelayableCallbackAction(secondsDelay, () => chatClient.SendMessage(_votingSystem.EndVoting())); _automatedActionSystem.AddAction(_endVoteCallback); return($"Vote will end in {secondsDelay} seconds."); } _endVoteCallback.SetTimeout(secondsDelay); return($"Vote will instead end in {secondsDelay} seconds."); }
private void WireUpCurrencyUpdate() { _automatedActionSystem.AddAction(_currencyUpdate); }
public GameScheduler(IAutomatedActionSystem automatedActionSystem) { _action = new RepeatingCallbackAction(OpenGameIfNeeded, _intervalInSeconds); automatedActionSystem.AddAction(_action); }