-
Notifications
You must be signed in to change notification settings - Fork 3
/
Utils.cs
46 lines (43 loc) · 1.26 KB
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.Net.Http;
using System.Windows.Forms;
namespace Webshook
{
public class Utils
{
public static void ToastNotification(string message)
{
new ToastContentBuilder()
.AddText("Webshook")
.AddText(message)
.Show();
}
#region Webhook Methods
public static string DeleteWebhook(string webhook)
{
try
{
HttpClient httpClient = new HttpClient();
var req = httpClient.DeleteAsync(new Uri(webhook));
return req.Result.Content.ToString();
}
catch (Exception ex)
{
switch (ex.Message)
{
case "Invalid":
ToastNotification("Webhook is invalid");
return "Invalid";
case "404":
ToastNotification("Webhook doesn't exist.");
return "Doesn't Exist";
default:
MessageBox.Show($"Error: {ex}");
return null;
}
}
}
#endregion
}
}