@somehiddenkey/discord-command-utils 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import GuildTutor from './GlobalConfigTutor.js';
|
|
|
10
10
|
import GuildStaff from './GlobalConfigStaff.js';
|
|
11
11
|
import { GuildBased } from '../NestedGlobalConfig.js';
|
|
12
12
|
import { Client } from 'discord.js';
|
|
13
|
+
import ConfigError from '../ConfigError.js';
|
|
13
14
|
|
|
14
15
|
export default class GlobalConfig {
|
|
15
16
|
/** @type {GuildMain} */
|
|
@@ -27,18 +28,20 @@ export default class GlobalConfig {
|
|
|
27
28
|
* @param {Client} bot
|
|
28
29
|
* @returns {GlobalConfig}
|
|
29
30
|
*/
|
|
30
|
-
static
|
|
31
|
+
static load(path, bot) {
|
|
31
32
|
var json;
|
|
32
33
|
try {
|
|
33
34
|
const raw = fs.readFileSync(path, { encoding: 'utf8', flag: 'r' });
|
|
34
35
|
json = JSON.parse(raw);
|
|
35
|
-
|
|
36
|
+
const g = new GlobalConfig(json.guilds, bot);
|
|
37
|
+
consola.start(`Loaded GlobalConfig from path: ${path}`);
|
|
38
|
+
return g;
|
|
36
39
|
} catch (error) {
|
|
37
40
|
throw new ConfigError(`Failed to load GlobalConfig from path: ${path}`, error);
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
/**
|
|
42
45
|
* @param {Snowflake} guild_id
|
|
43
46
|
* @returns {InteractionScope} scope
|
|
44
47
|
*/
|
|
@@ -40,12 +40,12 @@ export default class SecretConfig {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
databaseConfigs.push(db_config);
|
|
43
|
-
consola.start(`Loaded database config for section: ${section}`);
|
|
44
43
|
} catch (error) {
|
|
45
44
|
consola.error(`Failed to load database config for section: ${section}`, error);
|
|
46
45
|
throw error;
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
this.databaseConfig = databaseConfigs;
|
|
49
|
+
consola.start(`Loaded SecretConfig for environment: ${this.environment}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
Binary file
|