C# Discord.Net--如何让Bot Ping用户使用@&引用;

C# Discord.Net--如何让Bot Ping用户使用@&引用;,c#,tags,bots,discord,discord.net,C#,Tags,Bots,Discord,Discord.net,我正在编写一个机器人,它将根据搜索参数检索图像。当bot在命令后返回消息时,我希望bot向发送命令的用户发出ping警告。(在discord中使用“@”符号的消息通知) 以下是到目前为止我得到的信息: await Context.Channel.SendMessageAsync("@" + Context.Message.Author + "\n" + imageNode.Attributes["src"].Value); 我能够正确地抓取命令的作者,并按其应该的方式发送命令-- 通道中的输出

我正在编写一个机器人,它将根据搜索参数检索图像。当bot在命令后返回消息时,我希望bot向发送命令的用户发出ping警告。(在discord中使用“
@
”符号的消息通知)

以下是到目前为止我得到的信息:

await Context.Channel.SendMessageAsync("@" + Context.Message.Author + "\n" + imageNode.Attributes["src"].Value);
我能够正确地抓取命令的作者,并按其应该的方式发送命令--

通道中的输出:

但是,它实际上不是作为标记发送的,只是纯文本


有没有一种方法可以用通知通知用户?

是的,使用
用户。提及

await Context.Channel.SendMessageAsync(Context.Message.Author.Mention + "\n" + imageNode.Attributes["src"].Value);

您也可以将他们的id放在
之间。例如,
“Hello”

关于C#6,我最喜欢的一点是,您还可以使用字符串插值。在Discord.Net中非常有用

var id = Context.Message.Author.Id;
await Context.Channel.SendMessageAsync($"<@{id}> \n {imageNode.Attributes["src"].Value}";
var id=Context.Message.Author.id;
wait Context.Channel.SendMessageAsync($“\n{imageNode.Attributes[“src”].Value}”;

非常感谢!很难找到有关Discord的最新文档。请选择下面的答案作为正确答案好吗?