@wabot-dev/framework 0.1.0-beta.70 → 0.1.0-beta.71
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.
|
@@ -3,12 +3,14 @@ import { injectable } from '../../../core/injection/index.js';
|
|
|
3
3
|
import * as readline from 'readline';
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
+
import { Random } from '../../../core/random/Random.js';
|
|
6
7
|
|
|
7
8
|
var CmdChannel_1;
|
|
8
|
-
const
|
|
9
|
+
const chatIdPath = '.cmd-channel/id.json';
|
|
9
10
|
const authInfoPath = '.cmd-channel/auth-info.json';
|
|
10
11
|
let CmdChannel = CmdChannel_1 = class CmdChannel {
|
|
11
12
|
authInfo = undefined;
|
|
13
|
+
chatId = undefined;
|
|
12
14
|
rl = readline.createInterface({
|
|
13
15
|
input: process.stdin,
|
|
14
16
|
output: process.stdout,
|
|
@@ -28,8 +30,15 @@ let CmdChannel = CmdChannel_1 = class CmdChannel {
|
|
|
28
30
|
this.rl.close();
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
33
|
+
if (this.chatId === undefined) {
|
|
34
|
+
this.chatId = readJsonFromFile(chatIdPath) ?? undefined;
|
|
35
|
+
if (!this.chatId) {
|
|
36
|
+
this.chatId = Random.alphaNumericLowerCase(10);
|
|
37
|
+
writeJsonToFile(chatIdPath, this.chatId);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
const chatConnection = {
|
|
32
|
-
id: chatId,
|
|
41
|
+
id: this.chatId,
|
|
33
42
|
chatType: 'PRIVATE',
|
|
34
43
|
channelName: CmdChannel_1.name,
|
|
35
44
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1265,6 +1265,7 @@ declare function cmd(): (target: object, propertyKey: string | symbol) => void;
|
|
|
1265
1265
|
|
|
1266
1266
|
declare class CmdChannel implements IChatChannel {
|
|
1267
1267
|
private authInfo;
|
|
1268
|
+
private chatId;
|
|
1268
1269
|
private rl;
|
|
1269
1270
|
private callBack;
|
|
1270
1271
|
listen(callback: (message: IChannelMessage) => void): void;
|