public async Task Whois([Remainder][Summary("Der Name des WoW-Charakters")] string name) { using (var repository = _repositoryFactory.Invoke()) { var characters = repository.Characters .Where(c => _memberConfiguration.ShowNonGuildCharacters || c.GuildMembershipHistory.OrderByDescending(m => m.Timestamp).FirstOrDefault().State != GuildMemberState.Left) .ToList() .Where(c => _distanceCalculator.Distance(c.Name.ToLowerInvariant(), name.ToLowerInvariant()) < name.Length / 2.0); var messages = characters.Select(c => _messageBuilder.BuildMessage(c)); await Task.WhenAll(messages.Select(m => ReplyAsync("", false, m))); } }
public int GetDistance(string word1, string word2) { return((int)_levenshtein.Distance(word1, word2)); }