【发布时间】:2019-03-14 06:30:42
【问题描述】:
我正在尝试使用组设置一些嵌套命令,但父组的命令似乎具有优先权。
这是我的代码示例。
[Group("foo"), Summary("Testing foo")]
public class TestModule : ModuleBase<SocketCommandContext>
{
[Group("bar"), Summary("Testing bar")]
public class TestModTwo : ModuleBase<SocketCommandContext>
{
[Command, Summary("bar default command")]
public async Task Test()
{
await Context.Channel.SendMessageAsync("bar default command");
}
}
[Command, Summary("foo default command")]
public async Task Test()
{
await Context.Channel.SendMessageAsync("foo default command");
}
[Command, Summary("foo default command with string")]
public async Task Test(string User)
{
await Context.Channel.SendMessageAsync("foo default command with string");
}
}
运行我的命令w?foo bar 时,我的机器人返回“带有字符串的foo 默认命令”而不是所需的“bar 默认命令”。用字符串注释掉我的测试方法返回了我想要的。有没有办法指定我的嵌套命令,同时仍然能够接受父组命令中的字符串?
【问题讨论】:
标签: c# discord discord.net