Example #1
0
 public AmbiguousArgumentMatchException(DiscordIdType type, MatchQuery query, IDictionary <ulong, string> results)
     : base(GetMessage(type, query))
 {
     Query   = query;
     Type    = type;
     Results = results;
 }
Example #2
0
 private static string GetMessage(DiscordIdType type, MatchQuery query)
 {
     return(type switch
     {
         DiscordIdType.User => $"There were multiple users found with the name '{query.Value}'.",
         DiscordIdType.Role => $"There were multiple roles found with the name '{query.Value}'.",
         DiscordIdType.Channel => $"There were multiple channels found with the name '{query.Value}'.",
         _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
     });
Example #3
0
        private static string GetAmbiguousLocalizationKey(DiscordIdType type, bool supportsPendingCommands)
        {
            var key = type switch
            {
                DiscordIdType.User => "Command.AmbiguousUser",
                DiscordIdType.Role => "Command.AmbiguousRole",
                DiscordIdType.Channel => "Command.AmbiguousChannel",
                _ => throw new NotSupportedException()
            };

            if (!supportsPendingCommands)
            {
                key += ".Error";
            }

            return(key);
        }
    }