You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Api.Discord/DiscordApi.cs

29 lines
853 B

using System.Net.Http;
using System.Threading.Tasks;
using Ombi.Api.Discord.Models;
namespace Ombi.Api.Discord
{
public class DiscordApi : IDiscordApi
{
public DiscordApi()
{
Api = new Api();
}
private string Endpoint => "https://discordapp.com/api/"; //webhooks/270828242636636161/lLysOMhJ96AFO1kvev0bSqP-WCZxKUh1UwfubhIcLkpS0DtM3cg4Pgeraw3waoTXbZii
private Api Api { get; }
public async Task SendMessage(DiscordWebhookBody body, string webhookId, string webhookToken)
{
var request = new Request(Endpoint, $"webhooks/{webhookId}/{webhookToken}", HttpMethod.Post);
request.AddJsonBody(body);
request.AddHeader("Content-Type", "application/json");
await Api.Request(request);
}
}
}