-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiscordUtilitiesConfig.h
69 lines (51 loc) · 1.64 KB
/
DiscordUtilitiesConfig.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#pragma comment(lib, "ArkApi.lib")
// Standard headers
#include <fstream>
#include <random>
// Ark API headers
#include <API\ARK\Ark.h>
#include <Requests.h>
#include <json.hpp>
nlohmann::json PluginConfig;
bool IsAdmin = true;
inline bool Tag_enabled;
void LoadConfig()
{
std::ifstream file(ArkApi::Tools::GetCurrentDir() + "/ArkApi/Plugins/DiscordUtilities/config.json");
file >> PluginConfig;
file.close();
//Discord Things
const auto& discord_config = PluginConfig["TagNotifier"].value("Discord", nlohmann::json::object());
discord_enabled = discord_config.value("Enabled", false);
discord_sender_name = discord_config.value("SenderName", "").c_str();
discord_webhook_url = discord_config.value("URL", "").c_str();
const auto& sendInvite_config = PluginConfig.value("DiscordInvite", nlohmann::json::object());
Tag_enabled = sendInvite_config.value("Enabled", false);
auto command1 = PluginConfig["TagNotifier"]["Keywords"];
for (const auto& item1 : command1)
{
if (item1.is_string())
{
FString FStringValue = FString(item1.get<std::string>().c_str());
DiscordPing.Add(DiscordsPing(FStringValue));
}
}
for (const DiscordsPing& discordPing : DiscordPing) {
FString Tag = discordPing.Tag;
// DEBUG
//std::wcout << L"Trigger words: " << *Ping << std::endl;
}
auto command2 = PluginConfig["DiscordInvite"]["Keywords"];
for (const auto& item2 : command2)
{
if (item2.is_string())
{
FString FStringValue = FString(item2.get<std::string>().c_str());
DiscordInvite.Add(DiscordsInvite(FStringValue));
}
}
for (const DiscordsInvite& discordInvite : DiscordInvite) {
FString word = discordInvite.Word;
}
}