Send messages to your Discord channel via webhooks.
Download the entire repository from https://github.com/lumpn/unity-discord and use Unity's built in package manager to Add package from disk.
public WebhookData webhookData;
IEnumerator Start()
{
var webhook = webhookData.CreateWebhook();
return webhook.Send("Hello, World!");
}
Follow Discord's guide to creating a webhook in Discord, then copy the webhook URL, create a WebhookData
asset, and paste the webhook URL into the WebhookData
asset.
Samples are included in the package. Install them via Unity's package manager.
public WebhookData webhookData;
IEnumerator Start()
{
var embed = new Embed()
.SetColor(color)
.SetTitle(title)
.SetAuthor(author, authorIconUrl)
.SetDescription(description)
.SetThumbnail(thumbnailUrl)
.SetImage(MediaType.PNG, imageBytes)
.SetFooter(footer, footerIconUrl);
var webhook = webhookData.CreateWebhook();
return webhook.Send(embed);
}