kythia-core 0.9.4-beta.1 → 0.9.4-beta.2
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/changelog.md +7 -0
- package/package.json +1 -1
- package/src/Kythia.js +40 -8
package/changelog.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.9.4-beta.2](https://github.com/kenndeclouv/kythia-core/compare/v0.9.4-beta.1...v0.9.4-beta.2) (2025-11-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Added
|
|
9
|
+
|
|
10
|
+
* Enhance configuration validation in Kythia by adding checks for required bot and database settings, defaulting to SQLite if no driver is specified, and improving error logging for missing configurations. ([72148fa](https://github.com/kenndeclouv/kythia-core/commit/72148fa6b29a97da026746eb44fa4b8696744cb5))
|
|
11
|
+
|
|
5
12
|
### [0.9.4-beta.1](https://github.com/kenndeclouv/kythia-core/compare/v0.9.4-beta.0...v0.9.4-beta.1) (2025-11-09)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kythia-core",
|
|
3
|
-
"version": "0.9.4-beta.
|
|
3
|
+
"version": "0.9.4-beta.2",
|
|
4
4
|
"description": "Core library for the Kythia main Discord bot: extensible, modular, and scalable foundation for commands, components, and event management.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/src/Kythia.js
CHANGED
|
@@ -97,30 +97,62 @@ class Kythia {
|
|
|
97
97
|
* Throws an error if any required config is missing.
|
|
98
98
|
*/
|
|
99
99
|
_checkRequiredConfig() {
|
|
100
|
-
const
|
|
100
|
+
const requiredBotConfig = [
|
|
101
101
|
['bot', 'token'],
|
|
102
102
|
['bot', 'clientId'],
|
|
103
103
|
['bot', 'clientSecret'],
|
|
104
|
+
];
|
|
105
|
+
const missingBotConfigs = [];
|
|
106
|
+
for (const pathArr of requiredBotConfig) {
|
|
107
|
+
let value = this.kythiaConfig;
|
|
108
|
+
for (const key of pathArr) {
|
|
109
|
+
value = value?.[key];
|
|
110
|
+
}
|
|
111
|
+
if (value === undefined || value === null || value === '') {
|
|
112
|
+
missingBotConfigs.push(pathArr.join('.'));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!this.kythiaConfig.db) this.kythiaConfig.db = {};
|
|
117
|
+
|
|
118
|
+
let driver = this.kythiaConfig.db.driver;
|
|
119
|
+
if (!driver || driver === '') {
|
|
120
|
+
this.kythiaConfig.db.driver = 'sqlite';
|
|
121
|
+
driver = 'sqlite';
|
|
122
|
+
this.logger.info('💡 DB driver not specified. Defaulting to: sqlite');
|
|
123
|
+
} else {
|
|
124
|
+
driver = driver.toLowerCase();
|
|
125
|
+
this.kythiaConfig.db.driver = driver;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (driver === 'sqlite') {
|
|
129
|
+
if (!this.kythiaConfig.db.name || this.kythiaConfig.db.name === '') {
|
|
130
|
+
this.kythiaConfig.db.name = 'kythiadata.sqlite';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const requiredDbConfig = [
|
|
104
135
|
['db', 'driver'],
|
|
105
|
-
['db', 'host'],
|
|
106
|
-
['db', 'port'],
|
|
107
136
|
['db', 'name'],
|
|
108
|
-
['db', 'user'],
|
|
109
137
|
];
|
|
110
138
|
|
|
111
|
-
|
|
139
|
+
if (driver !== 'sqlite') {
|
|
140
|
+
requiredDbConfig.push(['db', 'host'], ['db', 'port'], ['db', 'user'], ['db', 'pass']);
|
|
141
|
+
}
|
|
112
142
|
|
|
113
|
-
|
|
143
|
+
const missingDbConfigs = [];
|
|
144
|
+
for (const pathArr of requiredDbConfig) {
|
|
114
145
|
let value = this.kythiaConfig;
|
|
115
146
|
for (const key of pathArr) {
|
|
116
147
|
value = value?.[key];
|
|
117
148
|
}
|
|
118
|
-
|
|
119
149
|
if (value === undefined || value === null || value === '') {
|
|
120
|
-
|
|
150
|
+
missingDbConfigs.push(pathArr.join('.'));
|
|
121
151
|
}
|
|
122
152
|
}
|
|
123
153
|
|
|
154
|
+
const missingConfigs = missingBotConfigs.concat(missingDbConfigs);
|
|
155
|
+
|
|
124
156
|
if (missingConfigs.length > 0) {
|
|
125
157
|
this.logger.error('❌ Required configurations are not set:');
|
|
126
158
|
for (const missing of missingConfigs) {
|