|
71 | 71 | include 'Handler.php'; |
72 | 72 | include 'messageHandler.php'; |
73 | 73 | include 'httpHandler.php'; |
| 74 | +include 'civ_token.php'; |
74 | 75 |
|
75 | 76 | // TODO: Add a timer and a callable function to update these IP addresses every 12 hours |
76 | 77 | $civ13_ip = gethostbyname('www.civ13.com'); |
|
81 | 82 | $webapi = null; |
82 | 83 | $socket = null; |
83 | 84 | $options = array( |
| 85 | + 'github' => 'https://github.com/VZGCoders/Civilizationbot', |
| 86 | + 'command_symbol' => '@Civilizationbot', |
| 87 | + 'owner_id' => '196253985072611328', // Taislin |
| 88 | + 'technician_id' => '116927250145869826', // Valithor |
| 89 | + 'civ13_guild_id' => '468979034571931648', // Civ13 |
| 90 | + 'discord_invite' => 'https://civ13.com/discord', |
| 91 | + 'discord_formatted' => 'civ13.com slash discord', |
| 92 | + 'rules' => 'civ13.com slash rules', |
| 93 | + 'relay_method' => 'webhook', |
84 | 94 | 'sharding' => false, // Enable sharding of the bot, allowing it to be run on multiple servers without conflicts, and suppressing certain responses where a shard may be handling the request |
85 | 95 | 'shard' => false, // Whether this instance is a shard |
| 96 | + 'legacy' => true, // Whether to use the filesystem or SQL database system |
| 97 | + 'moderate' => true, // Whether to moderate in-game chat |
86 | 98 | // The Verify URL is where verification requests are sent to and where the verification list is retrieved from |
87 | 99 | // The website must return valid json when no parameters are passed to it and MUST allow POST requests including 'token', 'ckey', and 'discord' |
88 | 100 | // Reach out to Valithor if you need help setting up your website |
89 | 101 | 'webserver_url' => 'www.valzargaming.com', |
90 | 102 | 'verify_url' => 'http://valzargaming.com:8080/verified/', // Leave this blank if you do not want to use the webserver, ckeys will be stored locally as provisional |
91 | | - // 'serverinfo_url' => '', // URL of the serverinfo.json file |
92 | | - 'discord_formatted' => 'civ13.com slash discord', |
93 | | - 'rules' => 'civ13.com slash rules', |
94 | | - 'github' => 'https://github.com/VZGCoders/Civilizationbot', |
95 | | - 'discord_invite' => 'https://civ13.com/discord', |
96 | | - 'command_symbol' => '@Civilizationbot', |
97 | | - 'owner_id' => '196253985072611328', // Taislin |
98 | | - 'technician_id' => '116927250145869826', // Valithor |
99 | | - 'civ13_guild_id' => '468979034571931648', // Civ13 |
100 | | - 'legacy' => true, |
101 | | - 'relay_method' => 'webhook', |
102 | | - 'moderate' => true, |
| 103 | + // 'serverinfo_url' => '', // URL of the serverinfo.json file, defaults to the webserver if left blank |
103 | 104 | 'ooc_badwords' => [ |
104 | 105 | /* Format: |
105 | 106 | 'word' => 'bad word' // Bad word to look for |
|
184 | 185 | 'nomads' => '753768513671397427', |
185 | 186 | 'pers' => '753768492834095235', |
186 | 187 | ), |
| 188 | +); |
| 189 | +$options['welcome_message'] = "Welcome to the Civ13 Discord Server! Please read the rules and verify your account using the `{$options['command_symbol']} approveme` chat command. Failure to verify in a timely manner will result in an automatic removal from the server."; |
| 190 | +foreach (['а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', 'і', 'ї', 'є'] as $char) { // // Ban use of Cyrillic characters |
| 191 | + $options['ooc_badwords'][] = ['word' => $char, 'duration' => '999 years', 'reason' => 'только английский.', 'category' => 'language', 'method' => 'str_contains', 'warnings' => 2]; |
| 192 | + $options['ic_badwords'][] = ['word' => $char, 'duration' => '999 years', 'reason' => 'только английский.', 'category' => 'language', 'method' => 'str_contains', 'warnings' => 2]; |
| 193 | +} |
187 | 194 |
|
| 195 | +// Write editable configurations to a single JSON file |
| 196 | +/* |
| 197 | +$json = json_encode($options, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); |
| 198 | +file_put_contents("config.json", $json); |
| 199 | +*/ |
| 200 | + |
| 201 | +// Load configurations from the JSON file |
| 202 | +/* |
| 203 | +$loadedData = []; |
| 204 | +$json = file_get_contents("config.json"); |
| 205 | +$loadedData = json_decode($json, true); |
| 206 | +foreach ($loadedData as $key => $value) $options[$key] = $value; |
| 207 | +*/ |
| 208 | + |
| 209 | +$hidden_options = [ |
188 | 210 | 'loop' => $loop, |
189 | 211 | 'discord' => $discord, |
190 | 212 | 'browser' => $browser, |
|
198 | 220 | 'http_port' => $http_port, |
199 | 221 | 'http_key' => $http_key, |
200 | 222 | 'http_whitelist' => $http_whitelist, |
| 223 | + 'civ_token' => getenv('CIV_TOKEN') ?? 'CHANGEME', |
201 | 224 | 'server_settings' => [ // Server specific settings, listed in the order in which they appear on the VZG server list. |
202 | 225 | 'TDM' => [ |
203 | 226 | 'supported' => true, |
|
309 | 332 | 'mass_promotion_check' => $mass_promotion_check, |
310 | 333 | ], |
311 | 334 | ), |
312 | | -); |
313 | | -$options['welcome_message'] = "Welcome to the Civ13 Discord Server! Please read the rules and verify your account using the `{$options['command_symbol']} approveme` chat command. Failure to verify in a timely manner will result in an automatic removal from the server."; |
314 | | -foreach (['а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', 'і', 'ї', 'є'] as $char) { // // Ban use of Cyrillic characters |
315 | | - $options['ooc_badwords'][] = ['word' => $char, 'duration' => '999 years', 'reason' => 'только английский.', 'category' => 'language', 'method' => 'str_contains', 'warnings' => 2]; |
316 | | - $options['ic_badwords'][] = ['word' => $char, 'duration' => '999 years', 'reason' => 'только английский.', 'category' => 'language', 'method' => 'str_contains', 'warnings' => 2]; |
317 | | -} |
318 | | -if (include 'civ_token.php') $options['civ_token'] = $civ_token; |
| 335 | +]; |
| 336 | +$options = array_merge($options, $hidden_options); |
| 337 | + |
319 | 338 |
|
320 | | -// Write editable configurations to a single JSON file |
321 | | -/* |
322 | | -$json = json_encode([ |
323 | | - //'server_settings' => $options['server_settings'], |
324 | | - 'github' => $options['github'], |
325 | | - 'command_symbol' => $options['command_symbol'], |
326 | | - 'owner_id' => $options['owner_id'], |
327 | | - 'technician_id' => $options['technician_id'], |
328 | | - 'civ13_guild_id' => $options['civ13_guild_id'], |
329 | | - 'discord_invite' => $options['discord_invite'], |
330 | | - 'discord_formatted' => $options['discord_formatted'], |
331 | | - 'rules' => $options['rules'], |
332 | | - 'relay_method' => $options['relay_method'], |
333 | | - 'sharding' => $options['sharding'], |
334 | | - 'shard' => $options['shard'], |
335 | | - 'legacy' => $options['legacy'], |
336 | | - 'moderate' => $options['moderate'], |
337 | | - 'webserver_url' => $options['webserver_url'], |
338 | | - 'verify_url' => $options['verify_url'], |
339 | | - 'channel_ids' => $options['channel_ids'], |
340 | | - 'role_ids' => $options['role_ids'], |
341 | | - 'files' => $options['files'], |
342 | | -], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); |
343 | | -file_put_contents("config.json", $json); |
344 | 339 |
|
345 | | -// Load configurations from the JSON file |
346 | | -$loadedData = []; |
347 | | -$json = file_get_contents("config.json"); |
348 | | -$loadedData = json_decode($json, true); |
349 | | -foreach ($loadedData as $key => $value) $options[$key] = $value; |
350 | | -*/ |
351 | 340 |
|
352 | 341 | $civ13 = new Civ13($options); |
353 | 342 | $global_error_handler = function (int $errno, string $errstr, ?string $errfile, ?int $errline) use ($civ13) { |
|
0 commit comments