Beispiel #1
0
        private async Task <string> DeleteLocationWeight(string[] commands, string[] locations)
        {
            if (commands.Length != 4)
            {
                return("You must specify a two location names to delete the weighting for.");
            }

            if (!locations.Contains(commands[2], StringComparer.InvariantCultureIgnoreCase))
            {
                return($"Location value \"{commands[2]}\" is invalid.");
            }

            if (!locations.Contains(commands[3], StringComparer.InvariantCultureIgnoreCase))
            {
                return($"Location value \"{commands[3]}\" is invalid.");
            }

            var existingConfig =
                GetLocationWeightConfig(commands[2], commands[3], _configRepository.GetAllGeneralConfig());

            if (existingConfig == null)
            {
                return($"No weighting found for locations {commands[2]} and {commands[3]}.");
            }

            await _configRepository.DeleteGeneralConfig(existingConfig);

            return("Location weight has been deleted.");
        }
Beispiel #2
0
        private async Task<string> DeleteNumberConfigMessage(List<string> commandWords)
        {
            if (commandWords.Count != 3)
            {
                return "You must specify a config name to delete.";
            }

            if (!_configRepository.GetGeneralConfig(commandWords[2]).HasValue)
            {
                return $"Config value {commandWords[2]} does not exist.";
            }

            await _configRepository.DeleteGeneralConfig(commandWords[2]);
            return "Config has been deleted.";
        }