Skip to content

Commit c3429c6

Browse files
committed
Update config
1 parent 6046830 commit c3429c6

2 files changed

Lines changed: 754 additions & 55 deletions

File tree

bot.php

Lines changed: 38 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
include 'Handler.php';
7272
include 'messageHandler.php';
7373
include 'httpHandler.php';
74+
include 'civ_token.php';
7475

7576
// TODO: Add a timer and a callable function to update these IP addresses every 12 hours
7677
$civ13_ip = gethostbyname('www.civ13.com');
@@ -81,25 +82,25 @@
8182
$webapi = null;
8283
$socket = null;
8384
$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',
8494
'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
8595
'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
8698
// The Verify URL is where verification requests are sent to and where the verification list is retrieved from
8799
// The website must return valid json when no parameters are passed to it and MUST allow POST requests including 'token', 'ckey', and 'discord'
88100
// Reach out to Valithor if you need help setting up your website
89101
'webserver_url' => 'www.valzargaming.com',
90102
'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
103104
'ooc_badwords' => [
104105
/* Format:
105106
'word' => 'bad word' // Bad word to look for
@@ -184,7 +185,28 @@
184185
'nomads' => '753768513671397427',
185186
'pers' => '753768492834095235',
186187
),
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+
}
187194

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 = [
188210
'loop' => $loop,
189211
'discord' => $discord,
190212
'browser' => $browser,
@@ -198,6 +220,7 @@
198220
'http_port' => $http_port,
199221
'http_key' => $http_key,
200222
'http_whitelist' => $http_whitelist,
223+
'civ_token' => getenv('CIV_TOKEN') ?? 'CHANGEME',
201224
'server_settings' => [ // Server specific settings, listed in the order in which they appear on the VZG server list.
202225
'TDM' => [
203226
'supported' => true,
@@ -309,45 +332,11 @@
309332
'mass_promotion_check' => $mass_promotion_check,
310333
],
311334
),
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+
319338

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);
344339

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-
*/
351340

352341
$civ13 = new Civ13($options);
353342
$global_error_handler = function (int $errno, string $errstr, ?string $errfile, ?int $errline) use ($civ13) {

0 commit comments

Comments
 (0)