我想让我的机器人把命令后的整个消息作为一个整体来讨论。但现在的情况是:
当我输入“!数学1+ 3”时,它只使用"1“作为参数。我希望机器人接受整个字符串"1 + 3“作为参数。
这是我的密码:
[Command("math")]
public async Task Calculate(string equation)
{
string result = new DataTable().Compute(equation, null).ToString();
//Basically to calculate from the string to find the result
if (result == "NaN")
{
await Context.Channel.SendMessageAsync("Infinity or undefined");
}
else
{
await Context.Channel.SendMessageAsync(result);
}
}我目前使用的是Discord.NET v1.0
发布于 2021-01-12 20:43:04
如果其他人不使用Discord.NET
public async Task Calc(CommandContext ctx, [RemainingText] string equation)https://stackoverflow.com/questions/42053824
复制相似问题