mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Added a webhook for hits with configurable URL to RL General Settings. For now it's just for custom made backedns, I will expand it later on with discord and telegram hooks.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Extreme.Net;
|
||||
using Newtonsoft.Json;
|
||||
using RuriLib.LS;
|
||||
using RuriLib.Models;
|
||||
using RuriLib.ViewModels;
|
||||
@@ -862,6 +863,23 @@ namespace RuriLib.Runner
|
||||
RaiseFoundHit(hit);
|
||||
}
|
||||
|
||||
// Call the webhook
|
||||
if (Settings.General.WebhookEnabled)
|
||||
{
|
||||
HttpRequest request = new HttpRequest();
|
||||
try
|
||||
{
|
||||
var toSend = new WebhookFormat(data, hitType, capturedData.ToCaptureString(), DateTime.Now, Config.Settings.Name, Config.Settings.Author);
|
||||
var json = JsonConvert.SerializeObject(toSend);
|
||||
//wc.UploadStringAsync(new Uri(Settings.General.WebhookURL), json);
|
||||
request.PostAsync(Settings.General.WebhookURL, json, "application/json");
|
||||
}
|
||||
catch
|
||||
{
|
||||
RaiseMessageArrived(LogLevel.Error, $"Could not register the hit to webhook {Settings.General.WebhookURL}");
|
||||
}
|
||||
}
|
||||
|
||||
// Wait time
|
||||
if (Settings.General.WaitTime > 0)
|
||||
Thread.Sleep(Settings.General.WaitTime);
|
||||
|
||||
Reference in New Issue
Block a user