Repository navigation
Expand file tree
/
Copy pathconfig.js
More file actions
105 lines (87 loc) · 4.28 KB
/
Copy pathconfig.js
File metadata and controls
105 lines (87 loc) · 4.28 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
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
100
101
102
103
104
105
/** ******************************
* GENERAL CONFIGURATION SETTINGS
********************************/
const LanguageLocaleCode = "en";
const Framework = "VORP"; // Wich Framework do you use? VORP or RSG
// PUBLIC VALUES
const FiveMServerName = "ServerName";
const DiscordInviteLink = "https://discord.gg/yourdiscord";
const FiveMServerIP = "127.0.0.1";
// This spams the console, only enable for testing if needed
const DebugLogs = false;
/** ********************
* DISCORD BOT SETTINGS
***********************/
const EnableDiscordBot = true;
// DISCORD BOT
const DiscordBotToken = "INPUT DISCORD TOKEN"; // DISCORD BOTS TOKEN
const DiscordGuildId = "INPUT DISCORD SERVER GULD ID"; // Discord server Guild ID
// SLASH COMMANDS / DISCORD PERMISSIONS
const EnableDiscordSlashCommands = true;
const DiscordModRoleId = "000000000000000000"; // supporter ROLE ID
const DiscordAdminRoleId = "000000000000000000"; // staff ROLE ID
const DiscordGodRoleId = "000000000000000000"; // udvikler ROLE ID
const DiscordGod2RoleId = "000000000000000000"; // Head udvikler ROLE ID
// DISCORD BOT STATUS
const EnableBotStatusMessages = false; // Set to false if other script's is running Status messages
const BotStatusMessages = [
"{servername}",
"{playercount} online",
];
/** ************************
* WEBHOOK LOGGING SETTINGS
**************************/
const EnableLoggingWebhooks = true;
const LoggingWebhookName = "CSS-Overwatch LOGS";
// put "&" in front of the id if you're to ping a role
const LoggingAlertPingId = "&000000000000000000";
// example: "bank": "https://discord.com/webhook/...",
// OBS!!! webhook skal pt ændres i log.js & config.json også
const LoggingWebhooks = "INPUT DISCORD WEBHOOK";
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !! DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING !!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
module.exports = {
EnableDiscordBot: getConBool("discord_enable_bot", EnableDiscordBot),
EnableLoggingWebhooks: getConBool("discord_enable_logging_webhooks", EnableLoggingWebhooks),
DebugLogs: getConBool("discord_debug", DebugLogs),
DiscordBotToken: GetConvar("discord_token", DiscordBotToken),
DiscordGuildId: GetConvar("discord_guild_id", DiscordGuildId),
LanguageLocaleCode: GetConvar("discord_lang", LanguageLocaleCode),
FiveMServerName: GetConvar("discord_server_name", FiveMServerName),
DiscordInviteLink: GetConvar("discord_invite", DiscordInviteLink),
FiveMServerIP: GetConvar("discord_server_ip", FiveMServerIP),
EnableDiscordSlashCommands: getConBool("discord_enable_commands", EnableDiscordSlashCommands),
DiscordModRoleId: GetConvar("discord_mod_role", DiscordModRoleId),
DiscordAdminRoleId: GetConvar("discord_admin_role", DiscordAdminRoleId),
DiscordGodRoleId: GetConvar("discord_god_role", DiscordGodRoleId),
DiscordGod2RoleId: GetConvar("discord_god2_role", DiscordGod2RoleId),
EnableBotStatusMessages: getConBool("discord_enable_status", EnableBotStatusMessages),
BotStatusMessages: BotStatusMessages,
LoggingWebhooks: LoggingWebhooks,
LoggingAlertPingId: GetConvar("discord_logging_ping_id", LoggingAlertPingId),
LoggingWebhookName: GetConvar("discord_logging_name", LoggingWebhookName),
Framework: Framework,
};
/** Returns convar or default value fixed to a true/false boolean
* @param {boolean|string|number} con - Convar name
* @param {boolean|string|number} def - Default fallback value
* @returns {boolean} - parsed bool */
function getConBool(con, def) {
if (typeof def == "boolean") def = def.toString();
const ret = GetConvar(con, def);
if (typeof ret == "boolean") return ret;
if (typeof ret == "string") return ["true", "on", "yes", "y", "1"].includes(ret.toLocaleLowerCase().trim());
if (typeof ret == "number") return ret > 0;
return false;
}
/** returns array of items or default array provided
* @param {string} con - string of comma separated values
* @param {string|Array} def - string of comma separated values
* @returns {object} - array of discord ids */
function getConList(con, def) {
const ret = GetConvar(con, def);
if (typeof ret == "string") return ret.replace(/[^0-9,]/g, "").replace(/(,$)/g, "").split(",");
if (Array.isArray(ret)) return ret;
if (!ret) return [];
}