|
@@ -50,7 +50,7 @@ namespace Discord.Interactions |
|
|
public abstract bool SupportsWildCards { get; } |
|
|
public abstract bool SupportsWildCards { get; } |
|
|
|
|
|
|
|
|
/// <inheritdoc/> |
|
|
/// <inheritdoc/> |
|
|
public bool IsTopLevelCommand => IgnoreGroupNames || !Module.IsTopLevelGroup; |
|
|
|
|
|
|
|
|
public bool IsTopLevelCommand { get; } |
|
|
|
|
|
|
|
|
/// <inheritdoc/> |
|
|
/// <inheritdoc/> |
|
|
public RunMode RunMode { get; } |
|
|
public RunMode RunMode { get; } |
|
@@ -72,6 +72,7 @@ namespace Discord.Interactions |
|
|
Name = builder.Name; |
|
|
Name = builder.Name; |
|
|
MethodName = builder.MethodName; |
|
|
MethodName = builder.MethodName; |
|
|
IgnoreGroupNames = builder.IgnoreGroupNames; |
|
|
IgnoreGroupNames = builder.IgnoreGroupNames; |
|
|
|
|
|
IsTopLevelCommand = IgnoreGroupNames || CheckTopLevel(Module); |
|
|
RunMode = builder.RunMode != RunMode.Default ? builder.RunMode : commandService._runMode; |
|
|
RunMode = builder.RunMode != RunMode.Default ? builder.RunMode : commandService._runMode; |
|
|
Attributes = builder.Attributes.ToImmutableArray(); |
|
|
Attributes = builder.Attributes.ToImmutableArray(); |
|
|
Preconditions = builder.Preconditions.ToImmutableArray(); |
|
|
Preconditions = builder.Preconditions.ToImmutableArray(); |
|
@@ -230,6 +231,20 @@ namespace Discord.Interactions |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static bool CheckTopLevel(ModuleInfo parent) |
|
|
|
|
|
{ |
|
|
|
|
|
var currentParent = parent; |
|
|
|
|
|
|
|
|
|
|
|
while (currentParent != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentParent.IsSlashGroup) |
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
currentParent = currentParent.Parent; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// ICommandInfo |
|
|
// ICommandInfo |
|
|
|
|
|
|
|
|
/// <inheritdoc/> |
|
|
/// <inheritdoc/> |
|
|