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:
ruri
2019-09-07 17:13:01 +02:00
parent 31a349db22
commit cd7b3046aa
6 changed files with 83 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RuriLib.Models
{
/// <summary>
/// The class that gets JSON-encoded and gets sent to the Webhook URL when a hit is found (if enabled).
/// </summary>
public class WebhookFormat
{
/// <summary>
/// Initializes the WebhookFormat object.
/// </summary>
/// <param name="data">The input data</param>
/// <param name="type">The hit type</param>
/// <param name="capturedData">The string-encoded captured data</param>
/// <param name="timestamp">The unix timestamp</param>
/// <param name="configName">The config name</param>
/// <param name="configAuthor">The config author</param>
public WebhookFormat(string data, string type, string capturedData, DateTime timestamp, string configName, string configAuthor)
{
Data = data;
Type = type;
CapturedData = capturedData;
Timestamp = Math.Round((timestamp.Subtract(new DateTime(1970, 1, 1))).TotalSeconds);
ConfigName = configName;
ConfigAuthor = configAuthor;
}
/// <summary>The input data.</summary>
public string Data { get; set; }
/// <summary>The hit type.</summary>
public string Type { get; set; }
/// <summary>The string-encoded captured data.</summary>
public string CapturedData { get; set; }
/// <summary>The unix timestamp.</summary>
public double Timestamp { get; set; }
/// <summary>The config name.</summary>
public string ConfigName { get; set; }
/// <summary>The config author.</summary>
public string ConfigAuthor { get; set; }
}
}