Exemple #1
0
        static ProfileBotCommand ParseAdminCommand(string normalizedMessage)
        {
            switch (normalizedMessage)
            {
            case "validate all users":
                return(ValidateAllProfilesCommand.Create());

            case "notify all users":
                return(NotifyAllProfilesCommand.Create());
            }

            var commandParts = normalizedMessage.Split(' ');

            if (commandParts.Length == 2 && commandParts[1].StartsWith("<@"))
            {
                var verb    = commandParts[0];
                var subject = new SlackStringUser(commandParts[1].ToUpper());
                switch (verb)
                {
                case "validate":
                    return(new ValidateSingleProfileCommand(subject));

                case "notify":
                    return(new NotifySingleProfileCommand(subject));
                }
            }

            return(UnknownCommand.Create());
        }
Exemple #2
0
        static ProfileBotCommand ParseAdminCommand(string normalizedMessage)
        {
            switch (normalizedMessage)
            {
            case "validate all users":
                return(ValidateAllProfilesCommand.Create());

            case "notify all users":
                return(NotifyAllProfilesCommand.Create());

            case "version":
                return(ShowVersionNumberCommand.Create());

            default:
                var commandParts = normalizedMessage.Split(' ');
                if (commandParts.Length == 2 && commandParts[1].StartsWith("<@") && commandParts[1][commandParts[1].Length - 1] == '>')
                {
                    return(ParseVerbSubjectCommands(commandParts));
                }

                if (normalizedMessage == "whitelist")
                {
                    return(ShowWhitelistedUsersCommand.Create());
                }

                return(UnknownCommand.Create());
            }
        }