public override void Process(IChatClient chatClient, CommandReceivedEventArgs eventArgs)
        {
            string username    = eventArgs?.ChatUser?.DisplayName;
            string argumentOne = eventArgs?.Arguments?.ElementAtOrDefault(0);

            if (_rockPaperScissorsGame.IsReadyForNewMatch())
            {
                _rockPaperScissorsGame.AttemptToStartNewGame(chatClient, username);
            }

            if (!RockPaperScissors.GetByName(argumentOne, out RockPaperScissors choice))
            {
                choice = RockPaperScissors.GetRandomChoice();
                chatClient.SendMessage($"{username} didn't want to pick, so we randomly assigned {choice}!");
            }
            _rockPaperScissorsGame.JoinMatch(chatClient, (username, choice));
        }
Ejemplo n.º 2
0
 public static bool GetByName(string name, out RockPaperScissors value)
 {
     value = All.SingleOrDefault(x => string.Compare(x.Name, name, StringComparison.OrdinalIgnoreCase) == 0);
     return(value != null);
 }