-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigJSON.cs
More file actions
55 lines (51 loc) · 2.04 KB
/
Copy pathConfigJSON.cs
File metadata and controls
55 lines (51 loc) · 2.04 KB
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
47
48
49
50
51
52
53
54
55
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DSharpPlus;
namespace EasyDiscordWhitelister.config
{
internal class ConfigJSON
{
public string BotToken { get; set; }
public ulong MemberRoleID { get; set; }
public ulong AdminRoleID { get; set; }
public ulong PublicWelcomeChannelID { get; set; }
public string WelcomeDM { get; set; }
public string PublicWelcomeMessage { get; set; }
public string PterodactylAPIAdress { get; set; }
public string PterodactylAPIKey { get; set; }
public string PterodactylServerID { get; set; }
public async Task ReadJSON()
{
using (StreamReader reader = new StreamReader("config.json"))
{
string json = await reader.ReadToEndAsync();
JSONlayout data = JsonConvert.DeserializeObject<JSONlayout>(json);
this.BotToken = data.BotToken;
this.MemberRoleID = data.MemberRoleID;
this.AdminRoleID = data.AdminRoleID;
this.WelcomeDM = data.WelcomeDM;
this.PublicWelcomeChannelID = data.PublicWelcomeChannelID;
this.PublicWelcomeMessage = data.PublicWelcomeMessage;
this.PterodactylAPIAdress = data.PterodactylAPIAdress;
this.PterodactylAPIKey = data.PterodactylAPIKey;
this.PterodactylServerID = data.PterodactylServerID;
}
}
}
internal sealed class JSONlayout
{
public string BotToken { get; set; }
public ulong MemberRoleID { get; set; }
public ulong AdminRoleID { get; set; }
public string WelcomeDM { get; set; }
public ulong PublicWelcomeChannelID { get; set; }
public string PublicWelcomeMessage { get; set; }
public string PterodactylAPIAdress { get; set; }
public string PterodactylAPIKey { get; set; }
public string PterodactylServerID { get; set; }
}
}