fix: Implement fix for Custom Id Segments NRE (#2274)
This commit is contained in:
@@ -834,12 +834,17 @@ namespace Discord.Interactions
|
|||||||
if (!searchResult.Command.SupportsWildCards || context is not IRouteMatchContainer matchContainer)
|
if (!searchResult.Command.SupportsWildCards || context is not IRouteMatchContainer matchContainer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (searchResult.RegexCaptureGroups?.Length > 0)
|
||||||
|
{
|
||||||
var matches = new RouteSegmentMatch[searchResult.RegexCaptureGroups.Length];
|
var matches = new RouteSegmentMatch[searchResult.RegexCaptureGroups.Length];
|
||||||
for (var i = 0; i < searchResult.RegexCaptureGroups.Length; i++)
|
for (var i = 0; i < searchResult.RegexCaptureGroups.Length; i++)
|
||||||
matches[i] = new RouteSegmentMatch(searchResult.RegexCaptureGroups[i]);
|
matches[i] = new RouteSegmentMatch(searchResult.RegexCaptureGroups[i]);
|
||||||
|
|
||||||
matchContainer.SetSegmentMatches(matches);
|
matchContainer.SetSegmentMatches(matches);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
matchContainer.SetSegmentMatches(Array.Empty<RouteSegmentMatch>());
|
||||||
|
}
|
||||||
|
|
||||||
internal TypeConverter GetTypeConverter(Type type, IServiceProvider services = null)
|
internal TypeConverter GetTypeConverter(Type type, IServiceProvider services = null)
|
||||||
=> _typeConverterMap.Get(type, services);
|
=> _typeConverterMap.Get(type, services);
|
||||||
|
|||||||
Reference in New Issue
Block a user