Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public DuelingSystem(IChatClient chatClient, IAutomatedActionSystem automatedActionSystem)
        {
            _chatClient = chatClient;
            _chatClient.OnWhisperReceived += ChatClientOnOnWhisperReceived;
            var repeatingCallbackAction = new RepeatingCallbackAction(CheckForExpiredDuels);

            automatedActionSystem.AddAction(repeatingCallbackAction);
        }
Exemplo n.º 4
0
        private void ScheduleAutomatedMessages()
        {
            var messages = _repository.List <IntervalMessage>();

            foreach (IntervalMessage message in messages)
            {
                _autoActionSystem.AddAction(new AutomatedMessage(message, _chatClients));
            }
        }
Exemplo n.º 5
0
        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.");
        }
Exemplo n.º 6
0
 private void WireUpCurrencyUpdate()
 {
     _automatedActionSystem.AddAction(_currencyUpdate);
 }
Exemplo n.º 7
0
 public GameScheduler(IAutomatedActionSystem automatedActionSystem)
 {
     _action = new RepeatingCallbackAction(OpenGameIfNeeded, _intervalInSeconds);
     automatedActionSystem.AddAction(_action);
 }