【发布时间】:2019-04-27 15:11:06
【问题描述】:
我需要替换以下代码中的IGuildUser。 (我在 DSharpPlus 中编码:https://github.com/DSharpPlus/DSharpPlus):
[Command("i_accept"), Description("Accept the rules and gain full access to the server.")]
[Hidden]
public async Task accept(CommandContext ctx)
{
var user = ctx.User;
var role = ctx.Guild.Roles.FirstOrDefault(x => x.Name == "Approved");
await (user as IGuildUser).AddRoleAsync(role);
await ctx.RespondAsync("You are now approved!");
}
【问题讨论】:
-
你的问题有点简洁。你能更详细地解释一下你遇到的问题吗?