我正在使用 dsharpplus 制作一个不和谐的机器人,现在我正在尝试实施一个禁令命令,但它不起作用。
[Command("ban")]
[Description("Ban user")]
[RequirePermissions(Permissions.BanMembers)]
[Hidden]
public async Task Ban(CommandContext ctx,
[Description("User banned")] DiscordMember member,
[Description("How many days will ban take?")] int days,
[RemainingText, Description("Reason")] string reason)
{
await ctx.TriggerTypingAsync();
DiscordGuild guild = member.Guild;
try
{
await guild.BanMemberAsync(member, days, reason);
await ctx.RespondAsync($"User @{member.Username}#{member.Discriminator} was excluded by the ADMIN {ctx.User.Username}");
}
catch (Exception)
{
await ctx.RespondAsync($"User {member.Username} cannot be blocked");
}
}
有人可以帮助我吗?我男人