rubika 1.2.4 → 1.2.5
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/README.md
CHANGED
|
@@ -11,15 +11,13 @@ async function start(this: Bot, token?: string) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} catch (err) {
|
|
19
|
-
await this.logger.error(`[start] error in token maby:${await err}`, "warn");
|
|
20
|
-
return
|
|
14
|
+
const res = await this.getMe();
|
|
15
|
+
|
|
16
|
+
if (res.status_message === "INVALID_TOKEN") {
|
|
17
|
+
throw new Error("[start] parse invalid token");
|
|
21
18
|
}
|
|
22
19
|
|
|
20
|
+
this.bot = res.bot;
|
|
23
21
|
this.initialize = true;
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -36,7 +36,7 @@ async function getBrowser(
|
|
|
36
36
|
.match(/(opera|chrome|safari|firefox|msie|trident)\/(\d+)/);
|
|
37
37
|
|
|
38
38
|
if (!deviceModelMatch) {
|
|
39
|
-
throw
|
|
39
|
+
throw new Error(`Cannot parse user-agent (${userAgent})`);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const deviceModel = `${deviceModelMatch[1]} ${deviceModelMatch[2]}`;
|
|
@@ -21,11 +21,13 @@ async function start(this: Client): Promise<void> {
|
|
|
21
21
|
this.key = Buffer.from(Crypto.passphrase(this.auth), "utf8");
|
|
22
22
|
this.decode_auth = Crypto.decode_auth(this.auth);
|
|
23
23
|
const result = await this.getUserInfo();
|
|
24
|
+
console.log(result);
|
|
25
|
+
|
|
24
26
|
this.userGuid = result.user.user_guid;
|
|
25
27
|
this.initialize = true;
|
|
26
28
|
} catch {
|
|
27
29
|
let phone_number: string = await prompt(
|
|
28
|
-
"Phone Number ex -> (989123456789)
|
|
30
|
+
"Phone Number ex -> (989123456789): ",
|
|
29
31
|
);
|
|
30
32
|
let is_phone_number_true = true;
|
|
31
33
|
|
|
@@ -57,7 +59,7 @@ async function start(this: Client): Promise<void> {
|
|
|
57
59
|
this.privateKey = privateKey;
|
|
58
60
|
|
|
59
61
|
while (true) {
|
|
60
|
-
let phone_code = await prompt(
|
|
62
|
+
let phone_code = await prompt(`Code [ ${result.send_type} ]: `);
|
|
61
63
|
|
|
62
64
|
let response = await this.signIn(
|
|
63
65
|
phone_code,
|
|
@@ -80,7 +82,10 @@ async function start(this: Client): Promise<void> {
|
|
|
80
82
|
private_key: this.privateKey,
|
|
81
83
|
});
|
|
82
84
|
|
|
83
|
-
await this.registerDevice();
|
|
85
|
+
const res = await this.registerDevice();
|
|
86
|
+
|
|
87
|
+
console.log(res);
|
|
88
|
+
|
|
84
89
|
break;
|
|
85
90
|
}
|
|
86
91
|
}
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED