根据对文本框的输入将消息发送到Discord服务器?

时间:2018-10-04 22:07:44

标签: c# discord

我试图在Visual Studio中使用C#制作应用程序应用程序。我需要一些帮助,我想提交这样的模板:

<discord tag>
Link: <link>
Description: <desc>

任何帮助都是有用的!谢谢!

1 个答案:

答案 0 :(得分:1)

假设您要发送文章链接:

public class Article
{
    public string Link { get; set; }
    public string Description { get; set; }
}

然后尝试:

// implement your required logic for getting the tag
string tag = GetTag();

// implement your required logic for getting the reference
Article article = GetLinkWithDescription();

// Prepare the message
string message = string.Join(
   "\n", 
   $"<@{tag}>", 
   $"Link: {article.Link}", 
   $"Description: {article.Description}"
); 

// send the message
await Context.Channel.SendMessageAsync(message);