chz-telegram-bot 0.0.6 → 0.0.8
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.
|
@@ -8,7 +8,7 @@ export default class JsonFileStorage implements IStorageClient {
|
|
|
8
8
|
private cache;
|
|
9
9
|
private storagePath;
|
|
10
10
|
private botName;
|
|
11
|
-
constructor(botName: string, path
|
|
11
|
+
constructor(botName: string, path?: string);
|
|
12
12
|
private lock;
|
|
13
13
|
private loadInternal;
|
|
14
14
|
private save;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonFileStorage.d.ts","sourceRoot":"","sources":["../../services/jsonFileStorage.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAG9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,cAAc;IAC1D,SAAS,YAAoB;IAC7B,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"jsonFileStorage.d.ts","sourceRoot":"","sources":["../../services/jsonFileStorage.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAG9D,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,cAAc;IAC1D,SAAS,YAAoB;IAC7B,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;YAiB5B,IAAI;YAUJ,YAAY;YAmBZ,IAAI;IAalB,OAAO,CAAC,eAAe;IAOjB,IAAI,CAAC,YAAY,SAAS,YAAY,EAAE,GAAG,EAAE,MAAM;IAMnD,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM;IAUzD,cAAc,CAAC,YAAY,SAAS,YAAY,EAClD,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM;IASZ,yBAAyB,CAC3B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB;IAYlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
|
@@ -13,6 +13,8 @@ class JsonFileStorage {
|
|
|
13
13
|
const targetPath = this.buidPathFromKey(`${this.storagePath}/${this.botName}`);
|
|
14
14
|
const folderName = (0, path_1.dirname)(targetPath);
|
|
15
15
|
if (!(0, fs_1.existsSync)(folderName)) {
|
|
16
|
+
console.log(this.storagePath, this.botName);
|
|
17
|
+
console.log(folderName, targetPath);
|
|
16
18
|
(0, fs_1.mkdirSync)(folderName, { recursive: true });
|
|
17
19
|
}
|
|
18
20
|
}
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ export default class JsonFileStorage implements IStorageClient {
|
|
|
14
14
|
private storagePath: string;
|
|
15
15
|
private botName: string;
|
|
16
16
|
|
|
17
|
-
constructor(botName: string, path
|
|
17
|
+
constructor(botName: string, path?: string) {
|
|
18
18
|
this.cache = new Map<string, Record<number, IActionState>>();
|
|
19
19
|
this.botName = botName;
|
|
20
20
|
this.storagePath = path ?? 'storage';
|
|
@@ -25,6 +25,8 @@ export default class JsonFileStorage implements IStorageClient {
|
|
|
25
25
|
const folderName = dirname(targetPath);
|
|
26
26
|
|
|
27
27
|
if (!existsSync(folderName)) {
|
|
28
|
+
console.log(this.storagePath, this.botName);
|
|
29
|
+
console.log(folderName, targetPath);
|
|
28
30
|
mkdirSync(folderName, { recursive: true });
|
|
29
31
|
}
|
|
30
32
|
}
|