通过 Webhook C# 发送 Discord 嵌入
Send a Discord Embed via Webhook C#
我有这段代码,我想通过嵌入式消息发送到 discord webhook:
var builder = new EmbedBuilder();
builder.WithTitle("Ice Wizard Stats");
builder.AddField("Hit Speed", "1.5sec", true); // True for inline
builder.WithThumbnailUrl("https://i.ibb.co/rc66Lq8/logonew.png");
builder.WithColor(Color.Red);
我该如何发送?
public class dWebHook: IDisposable
{
private readonly WebClient dWebClient;
private static NameValueCollection discord = new NameValueCollection();
public string WebHook { get; set;}
public string UserName { get; set; }
public string ProfilePicture { get; set;}
public dWebHook()
{
dWebClient = new WebClient();
}
public void SendMessage(string msgSend)
{
discord.Add("username", UserName);
discord.Add("avatar_url", ProfilePicture);
discord.Add("content", msgSend);
dWebClient.UploadValues(WebHook, discord);
}
public void Dispose()
{
dWebClient.Dispose();
}
我想这就是您要找的
我有这段代码,我想通过嵌入式消息发送到 discord webhook:
var builder = new EmbedBuilder();
builder.WithTitle("Ice Wizard Stats");
builder.AddField("Hit Speed", "1.5sec", true); // True for inline
builder.WithThumbnailUrl("https://i.ibb.co/rc66Lq8/logonew.png");
builder.WithColor(Color.Red);
我该如何发送?
public class dWebHook: IDisposable
{
private readonly WebClient dWebClient;
private static NameValueCollection discord = new NameValueCollection();
public string WebHook { get; set;}
public string UserName { get; set; }
public string ProfilePicture { get; set;}
public dWebHook()
{
dWebClient = new WebClient();
}
public void SendMessage(string msgSend)
{
discord.Add("username", UserName);
discord.Add("avatar_url", ProfilePicture);
discord.Add("content", msgSend);
dWebClient.UploadValues(WebHook, discord);
}
public void Dispose()
{
dWebClient.Dispose();
}
我想这就是您要找的