This repository has been archived by the owner on Jul 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.js
99 lines (95 loc) · 3.29 KB
/
config.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// If you are looking to modify your config, edit/create config.json instead of editing this file.
const user = require('./config.json')
const deepmerge = require('deepmerge');
const defaults = {
"pterodactyl": {
"daemon": undefined,
"server": undefined,
"token": undefined,
"status_texts": ['offline', 'online', 'starting', 'stopping']
},
"discord": {
"token": undefined,
"channels": {
"chat": undefined,
"log": undefined
},
"webhook": {
"id": undefined,
"token": undefined
}
},
"memlimit": {
"enabled": false,
"limit": 0.95,
"msg": "Server restarting to prevent instability in 15 seconds!",
"delay": 15
},
"bridge": {
"updateInterval": 2000,
"webhook": {
"userCacheTime": 3600,
"avatarApi": "https://crafatar.com/avatars/$UUID"
},
"msgTrimEmoji": "\uD83D\uDCAC", // U+1F4AC SPEECH BALLOON
"minecraft": {
"version": "release",
"colors": {
'black': '#000000',
'dark_blue': '#0000AA',
'dark_green': '#00AA00',
'dark_aqua': '#00AAAA',
'dark_red': '#AA0000',
'dark_purple': '#AA00AA',
'gold': '#FFAA00',
'gray': '#AAAAAA',
'dark_gray': '#555555',
'blue': '#5555FF',
'green': '#55FF55',
'aqua': '#55FFFF',
'red': '#FF5555',
'light_purple': '#FF55FF',
'yellow': '#FFFF55',
'white': '#FFFFFF',
},
"info_regex": /^\[.+] \[Server thread\/INFO]: (.+)$/,
"lang_action_regex": /^(death|multiplayer\.player|chat\.type\.advancement)\..+$/,
"action_blacklist_str": 'died, message:',
"tellraw": {
"prefix": "/tellraw @a ",
"json": [
{"text": "[D] ", "color": "blue"},
{
"text": "",
"color": "",
"clickEvent": {"action": "suggest_command","value": ""},
"hoverEvent": {"action":"show_text","value":[{"text":""},{"text":"\n"},{"text":""}]}
},
{"text": ": ", "color": "white"},
{"text": "", "color": "white"}
],
"set": {
"userColor": '1.color',
"userDisplay": '1.text',
"userId": '1.hoverEvent.value.2.text',
"userMention": '1.clickEvent.value',
"userTag": '1.hoverEvent.value.0.text',
"message": '3.text'
}
}
}
}
}
const config = deepmerge(defaults, user);
// https://stackoverflow.com/a/46818701
config._leaf = (obj, path, value) => {
const pList = path.split('.');
const key = pList.pop();
const pointer = pList.reduce((accumulator, currentValue) => {
if (accumulator[currentValue] === undefined) accumulator[currentValue] = {};
return accumulator[currentValue];
}, obj);
pointer[key] = value;
return obj;
}
module.exports = config