【发布时间】:2021-06-13 04:30:51
【问题描述】:
我是一个相当新的编码,并认为我会尝试制作一个不和谐的机器人。到目前为止,它很容易理解,我已经开始尝试为我的机器人发出命令。但我不知道如何让我的机器人给我 ping ex 的人发 DM。 !warn @person(原因)。我已经尝试查找它,但无法找到方法。
[Command("warn")]
[RequireUserPermission(GuildPermission.KickMembers, ErrorMessage = "You don't have the persmission ''warn_member''!")]
public async Task WarnMember(IGuildUser user = null, [Remainder] string reason = null)
{
if (user == null)
{
await ReplyAsync("Please Specify A User"); return;
}
if (reason == null) reason = "Not Specified";
这是我试图发送 DM 的地方,但它会将其发送给运行命令的人,而不是我 ping 的人
await Context.User.SendMessageAsync("You have been warned for " + reason);
var EmbedBuilder = new EmbedBuilder()
.WithDescription($":white_check_mark: {user.Mention} was warned\n**Reason **{reason}")
.WithFooter(footer =>
{
footer
.WithText("User Warn Log");
});
Embed embed = EmbedBuilder.Build();
await ReplyAsync(embed: embed);
}
【问题讨论】:
标签: c# discord discord.net