我有一个不和谐的机器人,可以发送私人消息。一旦我尝试在我的主要不和谐帐户上执行此命令,并且该命令有效,而在我的其他帐户上,此命令无效。我尝试在我的主要帐户上再次执行此操作(我事先重新启动了该漫游器),但此操作无效。我也有一个问题,我不能仅通过PM机器人来执行命令。这是我要使用的命令的代码。
[Command("accounts",RunMode = RunMode.Async)]
public async Task AccountsCommandHelp()
{
var user = UserAccounts.UserAccounts.GetAccount(Context.User);
user = UserAccounts.UserAccounts.GetAccount(Context.User);
string p = user.prefix;
string message = "**Commands:**\n" +
$"**{p}account stats @useryouwanttogetthestatsof** Gets the stats of the specified user. You don't have to specify a user. By default, the user specified is yourself \n \n" +
$"**{p}account sendmsg** Disables some messsages the bot sends.";
if (!Logic.IsPrivateMessage(Context.Message))
{
var h = Context.User.GetOrCreateDMChannelAsync();
SocketDMChannel c = await h as SocketDMChannel;
await Context.Message.DeleteAsync();
if (user.likesToSendMessages)
{
await Context.Channel.SendMessageAsync(":white_check_mark: Sent you a DM with information :)");
}
await c.SendMessageAsync(message);
}
else
{
await Context.Channel.SendMessageAsync(message);
}
}