Initial Plan for allowing custom Enum Type Readers

This commit is contained in:
Khionu Terabite
2016-07-20 15:17:22 -04:00
parent 2b9bb9fbb7
commit 63fdd67413

View File

@@ -75,11 +75,17 @@ namespace Discord.Commands
continue;
}
var typeInfo = type.GetTypeInfo();
if (typeInfo.IsEnum)
type = Enum.GetUnderlyingType(type);
var reader = Module.Service.GetTypeReader(type);
if (reader == null)
{
var typeInfo = type.GetTypeInfo();
if (typeInfo.IsEnum)
type = Enum.GetUnderlyingType(type);
reader = Module.Service.GetTypeReader(type);
}
if (reader == null)
throw new InvalidOperationException($"{type.FullName} is not supported as a command parameter, are you missing a TypeReader?");