简体   繁体   English

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

[英]Send message to Discord server based on input to text boxes?

I am trying to make an application app with C# in Visual Studio. 我试图在Visual Studio中使用C#制作应用程序应用程序。 I need some help with this, I want to submit a template like this: 我需要一些帮助,我想提交这样的模板:

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

Any help is useful! 任何帮助都是有用的! Thanks! 谢谢!

Say you want to message a link to an article: 假设您要向文章链接发送消息:

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

Then try: 然后尝试:

// 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM