@manybot/manybot 4.0.2 → 4.0.3
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 +1 -1
- package/src/config.js +0 -34
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* config.js
|
|
3
3
|
*
|
|
4
|
-
<<<<<<< HEAD
|
|
5
|
-
* Reads and parses manybot.conf and manyplug.conf.
|
|
6
|
-
* Supports multiline lists and inline comments.
|
|
7
|
-
=======
|
|
8
4
|
* Loads:
|
|
9
5
|
* ~/.manybot/manybot.conf
|
|
10
6
|
* ~/.manybot/manyplug.conf
|
|
11
7
|
*
|
|
12
8
|
* Merges both files into a single configuration object.
|
|
13
|
-
>>>>>>> dev
|
|
14
9
|
*/
|
|
15
10
|
|
|
16
11
|
import fs from "fs/promises";
|
|
@@ -144,10 +139,6 @@ async function readFileSafe(file) {
|
|
|
144
139
|
}
|
|
145
140
|
}
|
|
146
141
|
|
|
147
|
-
<<<<<<< HEAD
|
|
148
|
-
const filePath = path.join(__dirname, "../manybot.conf");
|
|
149
|
-
const plugFilePath = path.join(__dirname, "../manyplug.conf");
|
|
150
|
-
=======
|
|
151
142
|
const defaultConfig =
|
|
152
143
|
`
|
|
153
144
|
# Many bot configuration file
|
|
@@ -159,7 +150,6 @@ CHATS=[]
|
|
|
159
150
|
LANGUAGE=en
|
|
160
151
|
PHONE_NUMBER=
|
|
161
152
|
`;
|
|
162
|
-
>>>>>>> dev
|
|
163
153
|
|
|
164
154
|
try {
|
|
165
155
|
await fs.stat(CONFIG_FILE);
|
|
@@ -170,32 +160,8 @@ try {
|
|
|
170
160
|
await fs.writeFile(CONFIG_FILE, defaultConfig);
|
|
171
161
|
}
|
|
172
162
|
|
|
173
|
-
<<<<<<< HEAD
|
|
174
|
-
let plugRaw;
|
|
175
|
-
try {
|
|
176
|
-
plugRaw = fs.readFileSync(plugFilePath, "utf8");
|
|
177
|
-
} catch (err) {
|
|
178
|
-
if (err.code === "ENOENT") {
|
|
179
|
-
console.warn("Plugin file not found: manyplug.conf")
|
|
180
|
-
console.log("You probably don't have executed manyplug to install some plugins yet")
|
|
181
|
-
} else {
|
|
182
|
-
console.warn("Error when reading manyplug.conf: ", err.message);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
const bringTogheter = plugRaw !== undefined;
|
|
186
|
-
|
|
187
|
-
let completeRaw;
|
|
188
|
-
if (bringTogheter) {
|
|
189
|
-
completeRaw = raw + "\n" + plugRaw;
|
|
190
|
-
} else {
|
|
191
|
-
completeRaw = raw;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const config = parseConf(completeRaw);
|
|
195
|
-
=======
|
|
196
163
|
const baseConfig = await readFileSafe(CONFIG_FILE);
|
|
197
164
|
const pluginConfig = await readFileSafe(PLUGIN_FILE);
|
|
198
|
-
>>>>>>> dev
|
|
199
165
|
|
|
200
166
|
export const CONFIG = {
|
|
201
167
|
CMD_PREFIX: "!",
|