-
Notifications
You must be signed in to change notification settings - Fork 4
/
DiscordWebook.cs
40 lines (34 loc) · 1.04 KB
/
DiscordWebook.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
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace ValheimServerWarden
{
public class DiscordWebhook : IDisposable
{
private readonly WebClient dWebClient;
private static NameValueCollection discordValues = new NameValueCollection();
public string WebHook { get; set; }
public string UserName { get; set; }
public string ProfilePicture { get; set; }
public DiscordWebhook()
{
dWebClient = new WebClient();
}
public void SendMessage(string msgSend)
{
//discordValues.Add("username", UserName);
//discordValues.Add("avatar_url", ProfilePicture);
discordValues.Remove("content");
discordValues.Add("content", msgSend);
dWebClient.UploadValues(WebHook, discordValues);
}
public void Dispose()
{
dWebClient.Dispose();
}
}
}