C# 我想在discord.NET中执行unban命令,我是这样做的,但它不起作用。你能帮助我吗?

C# 我想在discord.NET中执行unban命令,我是这样做的,但它不起作用。你能帮助我吗?,c#,discord.net,C#,Discord.net,代码如下: [命令(“unban”)] [RequireUserPermission(GuildPermission.BanMembers,ErrorMessage=“您必须是最低限度的Alfa角色。然后您可以这样做。”)] 如图所示,Daniel说用户无法找到,因为他不再在机器人的范围内(如果机器人不在其他服务器上,他也在其中)你能通过google translate运行你的错误消息吗?它看起来有点像捷克语,但我不知道我不能说的语言,如果你能为我们翻译它,更多的人将能够提供帮助。虽然我猜你没有

代码如下:

[命令(“unban”)] [RequireUserPermission(GuildPermission.BanMembers,ErrorMessage=“您必须是最低限度的Alfa角色。然后您可以这样做。”)]


如图所示,Daniel说用户无法找到,因为他不再在机器人的范围内(如果机器人不在其他服务器上,他也在其中)

你能通过google translate运行你的错误消息吗?它看起来有点像捷克语,但我不知道我不能说的语言,如果你能为我们翻译它,更多的人将能够提供帮助。虽然我猜你没有足够的权限来执行unban的操作(基于minimálněAlfa,看起来像Minimuly Apha?)“Minimuly Alfa”是我服务器xD上的内部笑话,但thx对于你的观点,我会翻译它。我确信我拥有所有权限,而且机器人也可以,因为我的“禁止和踢”命令正在运行。如果帮会用户不在帮会中,你无法在命令参数中获得帮会用户。要想实现这一点,您应该将用户ID作为命令参数,并删除该ID的禁令。或者,您可以将用户信息存储在某个位置,然后根据记录查找字符串输入,以找到他们引用的用户。很好,谢谢,我会尝试的
    public async Task UnBanMember(IGuildUser user = null)
    {
        if (user == null)
        {
            await ReplyAsync("Guy you should write here who.");
            return;
        }

        await Context.Guild.RemoveBanAsync(user);

        ITextChannel InfoChannel = Context.Client.GetChannel(781145775467135006) as ITextChannel;
        var EmbedBuilder = new EmbedBuilder()
            .WithDescription($":white_check_mark: {user.Mention} was unbaned")
            .WithFooter(footer =>
            {
                footer
                .WithText("User Unban Log");
            });
        Embed embed = EmbedBuilder.Build();
        await InfoChannel.SendMessageAsync(embed: embed);

        //Loging unbans//

        ITextChannel logChannel = Context.Client.GetChannel(793188013848789042) as ITextChannel;
        var EmbedBuilderLog = new EmbedBuilder()
            .WithDescription($"{user.Mention} was unbaned\n**Moderator** {Context.User.Mention}")
            .WithFooter(footer =>
            {
                footer
                .WithText("User Unban Log");
            });
        Embed embedLog = EmbedBuilderLog.Build();
        await logChannel.SendMessageAsync(embed: embedLog);