-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdebug_link_responses.js
62 lines (51 loc) · 2.38 KB
/
debug_link_responses.js
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
const hasGroupRule = (rules, column) => {
return rules.filter(
rule => rule[column] !== null
).length > 0;
}
module.exports = [
// another example...
minecraftGroupSyncCheck = {
execute: (debugData, text) => {
if (!text.includes("group sync")) {
return false;
}
const errors = (() => {
const errors = [];
if (!debugData.namelessmc.version === '2.0.0-pr13') {
errors.push("- `Please ensure you are running NamelessMC 2.0.0 pre13.`");
}
if (!debugData.namelessmc.settings.api_enabled) {
errors.push("- `Please ensure your NamelessMC API is enabled in StaffCP -> Configuration -> API.`");
}
if (!debugData.namelessmc.modules['Core'].debug_info.minecraft.mc_integration) {
errors.push("- `Please ensure you have enabled Minecraft integration in StaffCP -> Integrations -> Minecraft.`");
}
if (!Object.keys(debugData.namelessmc.modules['Core'].debug_info.minecraft.servers) > 0) {
errors.push("- `Please ensure you have a least one Minecraft server in StaffCP -> Integrations -> Minecraft -> Servers.`");
}
if (!Object.keys(debugData.namelessmc.settings.group_sync.rules).length > 0) {
errors.push("- `Please ensure you have configured Group Sync rules in StaffCP -> Configuration -> API -> Group Sync.`");
}
if (!hasGroupRule(debugData.namelessmc.settings.group_sync.rules, 'ingame_group_name')) {
errors.push("- `Please ensure at least one of your Group Sync rules has a Minecraft group attached in StaffCP -> Configuration -> API -> Group Sync.`");
}
return errors.length > 0
? errors
: true;
})();
if (errors === true) {
// no errors
return;
}
return {
"title": "Minecraft Group Sync not working",
"footer": "",
"body": [
"Troubleshooting steps for configuring Minecraft Group Sync:\n",
...errors.map(error => `\`*\` ${error}`),
]
}
}
}
]