rubjs 1.0.0

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.
Files changed (66) hide show
  1. package/README.md +0 -0
  2. package/package.json +40 -0
  3. package/rubjs/client.d.ts +34 -0
  4. package/rubjs/client.js +47 -0
  5. package/rubjs/crypto/index.d.ts +12 -0
  6. package/rubjs/crypto/index.js +95 -0
  7. package/rubjs/index.d.ts +4 -0
  8. package/rubjs/index.js +11 -0
  9. package/rubjs/methods/advanced/builder.d.ts +3 -0
  10. package/rubjs/methods/advanced/builder.js +41 -0
  11. package/rubjs/methods/advanced/index.d.ts +2 -0
  12. package/rubjs/methods/advanced/index.js +8 -0
  13. package/rubjs/methods/auth/index.d.ts +4 -0
  14. package/rubjs/methods/auth/index.js +12 -0
  15. package/rubjs/methods/auth/register_device.d.ts +3 -0
  16. package/rubjs/methods/auth/register_device.js +61 -0
  17. package/rubjs/methods/auth/send_code.d.ts +4 -0
  18. package/rubjs/methods/auth/send_code.js +25 -0
  19. package/rubjs/methods/auth/sign_in.d.ts +4 -0
  20. package/rubjs/methods/auth/sign_in.js +24 -0
  21. package/rubjs/methods/index.d.ts +21 -0
  22. package/rubjs/methods/index.js +40 -0
  23. package/rubjs/methods/users/get_user_info.d.ts +4 -0
  24. package/rubjs/methods/users/get_user_info.js +18 -0
  25. package/rubjs/methods/users/index.d.ts +2 -0
  26. package/rubjs/methods/users/index.js +8 -0
  27. package/rubjs/methods/utilities/index.d.ts +3 -0
  28. package/rubjs/methods/utilities/index.js +10 -0
  29. package/rubjs/methods/utilities/on_chat_updates.d.ts +4 -0
  30. package/rubjs/methods/utilities/on_chat_updates.js +17 -0
  31. package/rubjs/methods/utilities/on_message_updates.d.ts +4 -0
  32. package/rubjs/methods/utilities/on_message_updates.js +17 -0
  33. package/rubjs/methods/utilities/on_show_activities.d.ts +4 -0
  34. package/rubjs/methods/utilities/on_show_activities.js +17 -0
  35. package/rubjs/methods/utilities/on_show_notifications.d.ts +4 -0
  36. package/rubjs/methods/utilities/on_show_notifications.js +21 -0
  37. package/rubjs/methods/utilities/run.d.ts +3 -0
  38. package/rubjs/methods/utilities/run.js +17 -0
  39. package/rubjs/methods/utilities/start.d.ts +3 -0
  40. package/rubjs/methods/utilities/start.js +68 -0
  41. package/rubjs/network/index.d.ts +29 -0
  42. package/rubjs/network/index.js +172 -0
  43. package/rubjs/session/index.d.ts +18 -0
  44. package/rubjs/session/index.js +57 -0
  45. package/rubjs/types/chat_updates.d.ts +26 -0
  46. package/rubjs/types/chat_updates.js +2 -0
  47. package/rubjs/types/filters_optiom.d.ts +10 -0
  48. package/rubjs/types/filters_optiom.js +2 -0
  49. package/rubjs/types/get_user_info.d.ts +63 -0
  50. package/rubjs/types/get_user_info.js +2 -0
  51. package/rubjs/types/index.d.ts +9 -0
  52. package/rubjs/types/index.js +2 -0
  53. package/rubjs/types/message_update.d.ts +112 -0
  54. package/rubjs/types/message_update.js +2 -0
  55. package/rubjs/types/send_code.d.ts +10 -0
  56. package/rubjs/types/send_code.js +2 -0
  57. package/rubjs/types/show_activities.d.ts +7 -0
  58. package/rubjs/types/show_activities.js +2 -0
  59. package/rubjs/types/show_notifications.d.ts +14 -0
  60. package/rubjs/types/show_notifications.js +2 -0
  61. package/rubjs/types/sign_in.d.ts +30 -0
  62. package/rubjs/types/sign_in.js +2 -0
  63. package/rubjs/utils/filters.d.ts +26 -0
  64. package/rubjs/utils/filters.js +72 -0
  65. package/rubjs/utils/index.d.ts +2 -0
  66. package/rubjs/utils/index.js +8 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ function on_show_activities(filters, callback) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ this.eventHandlers.push({ callback, filters, updateType: "show_activities" });
15
+ });
16
+ }
17
+ exports.default = on_show_activities;
@@ -0,0 +1,4 @@
1
+ import Client from "../..";
2
+ import { MessageUpdate } from "../../types";
3
+ declare function on_show_notifications(this: Client, filters: ((msg: any) => boolean)[], callback: (message: MessageUpdate) => void): Promise<void>;
4
+ export default on_show_notifications;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ function on_show_notifications(filters, callback) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ this.eventHandlers.push({
15
+ callback,
16
+ filters,
17
+ updateType: "show_notifications",
18
+ });
19
+ });
20
+ }
21
+ exports.default = on_show_notifications;
@@ -0,0 +1,3 @@
1
+ import Client from "../..";
2
+ declare function run(this: Client): Promise<void>;
3
+ export default run;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ function run() {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ yield this.network.getUpdates();
15
+ });
16
+ }
17
+ exports.default = run;
@@ -0,0 +1,3 @@
1
+ import Client from "../..";
2
+ declare function start(this: Client): Promise<void>;
3
+ export default start;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const crypto_1 = __importDefault(require("../../crypto"));
16
+ const input_1 = __importDefault(require("input"));
17
+ function start() {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ this.key = Buffer.from(crypto_1.default.passphrase(this.auth), "utf8");
21
+ this.decode_auth = crypto_1.default.decode_auth(this.auth);
22
+ const result = yield this.get_user_info();
23
+ this.userGuid = result.user.user_guid;
24
+ }
25
+ catch (error) {
26
+ if (this.auth)
27
+ throw new Error("robot has any error" + error.message);
28
+ let phone_number = yield input_1.default.text("Phone Number: ");
29
+ let is_phone_number_true = true;
30
+ const phoneRegex = /^[0-9]{11}$/;
31
+ while (is_phone_number_true) {
32
+ const answer = yield input_1.default.text(`Is the ${phone_number} correct [y or n]: `);
33
+ if (answer.toLowerCase() === "y" && phoneRegex.test(phone_number)) {
34
+ is_phone_number_true = false;
35
+ }
36
+ else {
37
+ phone_number = yield input_1.default.text("Phone Number ex -> (09123456789) : ");
38
+ }
39
+ }
40
+ phone_number = `98${phone_number.slice(1)}`;
41
+ let result = yield this.send_code(phone_number);
42
+ if (result.status == "SendPassKey") {
43
+ while (true) {
44
+ let pass_key = yield input_1.default.text(`Password [${result.hint_pass_key}] > `);
45
+ result = yield this.send_code((phone_number = phone_number), (pass_key = pass_key));
46
+ if (result.status == "OK")
47
+ break;
48
+ }
49
+ }
50
+ let [publicKey, privateKey] = crypto_1.default.createKeys();
51
+ this.privateKey = privateKey;
52
+ while (true) {
53
+ let phone_code = yield input_1.default.text("Code: ");
54
+ let response = yield this.sign_in(phone_code, phone_number, result.phone_code_hash, publicKey);
55
+ if (response.status === "OK") {
56
+ response.auth = crypto_1.default.decrypt_RSA_OAEP(this.privateKey, response.auth);
57
+ this.key = Buffer.from(crypto_1.default.passphrase(response.auth), "utf8");
58
+ this.auth = response.auth;
59
+ this.decode_auth = crypto_1.default.decode_auth(this.auth);
60
+ this.sessionDb.saveSession(response.user.phone, this.auth, response.user.user_guid, this.userAgent, this.privateKey);
61
+ yield this.register_device();
62
+ break;
63
+ }
64
+ }
65
+ }
66
+ });
67
+ }
68
+ exports.default = start;
@@ -0,0 +1,29 @@
1
+ import { Axios } from "axios";
2
+ import WebSocket from "ws";
3
+ import https from "https";
4
+ import Client from "..";
5
+ declare class Network {
6
+ private heartbeatInterval;
7
+ Headers: {
8
+ [key: string]: string;
9
+ };
10
+ client: Client;
11
+ session: Axios;
12
+ api_url: null | string;
13
+ wss_url: null | string;
14
+ ws: WebSocket;
15
+ agent: https.Agent;
16
+ constructor(client: Client);
17
+ getDcs(): Promise<boolean>;
18
+ request(url: string, data: Record<string, any>): Promise<any>;
19
+ send({ input, method, tmp_session, }: {
20
+ input: object;
21
+ method: string;
22
+ tmp_session: boolean;
23
+ }): Promise<any>;
24
+ getUpdates(): Promise<void>;
25
+ handleConnect(): Promise<void>;
26
+ resetConnection(): Promise<void>;
27
+ handleMessage(message: string): Promise<void>;
28
+ }
29
+ export default Network;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const axios_1 = __importDefault(require("axios"));
16
+ const ws_1 = __importDefault(require("ws"));
17
+ const crypto_1 = __importDefault(require("../crypto"));
18
+ const https_1 = __importDefault(require("https"));
19
+ class Network {
20
+ constructor(client) {
21
+ this.heartbeatInterval = null;
22
+ this.Headers = {
23
+ origin: "https://web.rubika.ir",
24
+ referer: "https://web.rubika.ir/",
25
+ "content-type": "application/json",
26
+ connection: "keep-alive",
27
+ };
28
+ this.client = client;
29
+ this.Headers["user-agent"] = this.client.userAgent;
30
+ if (this.client.defaultPlatform["platform"] === "Android") {
31
+ delete this.Headers["origin"];
32
+ delete this.Headers["referer"];
33
+ this.Headers["user-agent"] = "okhttp/3.12.1";
34
+ this.client.defaultPlatform["package"] = "app.rbmain.a";
35
+ this.client.defaultPlatform["app_version"] = "3.6.4";
36
+ }
37
+ this.agent = new https_1.default.Agent({ rejectUnauthorized: false });
38
+ const axiosConfig = {
39
+ headers: this.Headers,
40
+ timeout: this.client.timeout || 10000,
41
+ httpsAgent: this.agent,
42
+ };
43
+ this.session = axios_1.default.create(axiosConfig);
44
+ this.api_url = null;
45
+ this.wss_url = null;
46
+ this.ws = null;
47
+ }
48
+ getDcs() {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ while (true) {
51
+ try {
52
+ const response = yield axios_1.default.get("https://getdcmess.iranlms.ir/", {
53
+ httpsAgent: this.agent,
54
+ });
55
+ if (response.status === 200) {
56
+ const data = response.data.data;
57
+ this.api_url = data.API[data.default_api] + "/";
58
+ this.wss_url = data.socket[data.default_socket];
59
+ return true;
60
+ }
61
+ }
62
+ catch (error) {
63
+ console.error("Error while fetching dcs:", error);
64
+ continue;
65
+ }
66
+ }
67
+ });
68
+ }
69
+ request(url, data) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ for (let i = 0; i < 3; i++) {
72
+ try {
73
+ const response = yield this.session.post(url, data);
74
+ if (response.status === 200) {
75
+ return response.data;
76
+ }
77
+ }
78
+ catch (error) {
79
+ console.error("Error in request:", error);
80
+ continue;
81
+ }
82
+ }
83
+ throw new Error("Failed to get response after 3 attempts");
84
+ });
85
+ }
86
+ send(_a) {
87
+ return __awaiter(this, arguments, void 0, function* ({ input = {}, method = "getUserInfo", tmp_session, }) {
88
+ let api_version = this.client.apiVersion;
89
+ let auth = this.client.auth;
90
+ let client = this.client.defaultPlatform;
91
+ if (!this.api_url)
92
+ yield this.getDcs();
93
+ let url = this.api_url;
94
+ let data = { api_version };
95
+ data[tmp_session ? "tmp_session" : "auth"] = tmp_session
96
+ ? auth
97
+ : this.client.decode_auth;
98
+ if (api_version === "6") {
99
+ const data_enc = JSON.stringify({
100
+ client,
101
+ method,
102
+ input,
103
+ });
104
+ data["data_enc"] = crypto_1.default.encrypt(data_enc, this.client.key);
105
+ if (!tmp_session) {
106
+ data["sign"] = crypto_1.default.sign(data["data_enc"], this.client.privateKey);
107
+ }
108
+ return yield this.request(url, data);
109
+ }
110
+ });
111
+ }
112
+ getUpdates() {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ if (!this.wss_url)
115
+ yield this.getDcs();
116
+ this.ws = new ws_1.default(this.wss_url);
117
+ this.ws.on("open", () => __awaiter(this, void 0, void 0, function* () { return yield this.handleConnect(); }));
118
+ this.ws.on("message", (message) => __awaiter(this, void 0, void 0, function* () { return yield this.handleMessage(message); }));
119
+ this.ws.on("error", () => __awaiter(this, void 0, void 0, function* () { return yield this.resetConnection(); }));
120
+ });
121
+ }
122
+ handleConnect() {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ console.log("Start Bot..");
125
+ const handshakeRequest = {
126
+ api_version: "5",
127
+ auth: this.client.auth,
128
+ data: "",
129
+ method: "handShake",
130
+ };
131
+ this.ws.send(JSON.stringify(handshakeRequest));
132
+ if (this.heartbeatInterval) {
133
+ clearInterval(this.heartbeatInterval);
134
+ }
135
+ this.heartbeatInterval = setInterval(() => {
136
+ if (this.ws.readyState === ws_1.default.OPEN) {
137
+ this.ws.send(JSON.stringify({}));
138
+ }
139
+ }, 30 * 1000);
140
+ });
141
+ }
142
+ resetConnection() {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ setTimeout(() => this.getUpdates(), 5000);
145
+ });
146
+ }
147
+ handleMessage(message) {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ try {
150
+ const { data_enc } = JSON.parse(message);
151
+ if (!data_enc)
152
+ return;
153
+ const update = JSON.parse(crypto_1.default.decrypt(data_enc, this.client.key));
154
+ this.client.eventHandlers.forEach((_a) => __awaiter(this, [_a], void 0, function* ({ callback, filters = [], updateType }) {
155
+ var _b;
156
+ const messageData = (_b = update[updateType]) === null || _b === void 0 ? void 0 : _b[0];
157
+ if (!messageData)
158
+ return;
159
+ const isValid = filters.length === 0 ||
160
+ filters.every((filter) => __awaiter(this, void 0, void 0, function* () { return yield filter(messageData); }));
161
+ if (isValid) {
162
+ yield callback(messageData);
163
+ }
164
+ }));
165
+ }
166
+ catch (error) {
167
+ console.error("Error in handleMessage:", error);
168
+ }
169
+ });
170
+ }
171
+ }
172
+ exports.default = Network;
@@ -0,0 +1,18 @@
1
+ interface SessionData {
2
+ phone: string;
3
+ auth: string;
4
+ guid: string;
5
+ agent: string;
6
+ private_key: string;
7
+ }
8
+ declare class SQLiteSession {
9
+ private dbFile;
10
+ private db;
11
+ constructor(sessionName: string);
12
+ private handleError;
13
+ private initializeDB;
14
+ getSession(): SessionData | null;
15
+ saveSession(phone: string, auth: string, guid: string, agent: string, privateKey: string): void;
16
+ closeDB(): void;
17
+ }
18
+ export default SQLiteSession;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
7
+ class SQLiteSession {
8
+ constructor(sessionName) {
9
+ this.dbFile = sessionName.endsWith(".rp") ? sessionName : `${sessionName}.rp`;
10
+ this.db = new better_sqlite3_1.default(this.dbFile);
11
+ this.db.pragma("journal_mode = WAL");
12
+ this.initializeDB();
13
+ }
14
+ handleError(operation, callback) {
15
+ try {
16
+ return callback();
17
+ }
18
+ catch (error) {
19
+ console.error(`Error in ${operation}:`, error);
20
+ throw new Error(`Failed to execute ${operation}`);
21
+ }
22
+ }
23
+ initializeDB() {
24
+ this.handleError("initializeDB", () => {
25
+ const sessionTable = this.db
26
+ .prepare("SELECT name FROM sqlite_master WHERE type=? AND name=?")
27
+ .get("table", "session");
28
+ if (!sessionTable) {
29
+ this.db.prepare(`CREATE TABLE session (
30
+ phone TEXT PRIMARY KEY,
31
+ auth TEXT,
32
+ guid TEXT,
33
+ agent TEXT,
34
+ private_key TEXT
35
+ )`).run();
36
+ }
37
+ });
38
+ }
39
+ getSession() {
40
+ return this.handleError("getSession", () => {
41
+ const result = this.db.prepare("SELECT * FROM session").get();
42
+ return result ? result : null;
43
+ });
44
+ }
45
+ saveSession(phone, auth, guid, agent, privateKey) {
46
+ this.handleError("saveSession", () => {
47
+ this.db.prepare(`INSERT OR REPLACE INTO session (phone, auth, guid, agent, private_key)
48
+ VALUES (?, ?, ?, ?, ?)`).run(phone, auth, guid, agent, privateKey);
49
+ });
50
+ }
51
+ closeDB() {
52
+ this.handleError("closeDB", () => {
53
+ this.db.close();
54
+ });
55
+ }
56
+ }
57
+ exports.default = SQLiteSession;
@@ -0,0 +1,26 @@
1
+ interface ChatUpdates {
2
+ object_guid: string;
3
+ action: string;
4
+ chat: {
5
+ time_string: string;
6
+ last_message: {
7
+ message_id: string;
8
+ type: string;
9
+ text: string;
10
+ author_object_guid?: string;
11
+ is_mine: boolean;
12
+ author_title?: string;
13
+ author_type?: string;
14
+ };
15
+ last_seen_peer_mid?: string;
16
+ last_seen_my_mid?: string;
17
+ status?: string;
18
+ time: number;
19
+ last_message_id: string;
20
+ group_voice_chat_id?: string;
21
+ };
22
+ updated_parameters: string[];
23
+ timestamp: string;
24
+ type: string;
25
+ }
26
+ export default ChatUpdates;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ interface FilterOption {
2
+ is_text?: boolean;
3
+ is_link?: boolean;
4
+ is_group?: boolean;
5
+ is_channel?: boolean;
6
+ is_private?: boolean;
7
+ is_file?: boolean;
8
+ is_froward?: boolean;
9
+ }
10
+ export default FilterOption;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,63 @@
1
+ interface AvatarThumbnail {
2
+ file_id: string;
3
+ mime: string;
4
+ dc_id: string;
5
+ access_hash_rec: string;
6
+ }
7
+ interface OnlineTime {
8
+ type: string;
9
+ exact_time: number;
10
+ }
11
+ interface User {
12
+ user_guid: string;
13
+ first_name: string;
14
+ phone: string;
15
+ username: string;
16
+ avatar_thumbnail: AvatarThumbnail;
17
+ last_online: number;
18
+ is_deleted: boolean;
19
+ is_verified: boolean;
20
+ online_time: OnlineTime;
21
+ }
22
+ interface LastMessage {
23
+ message_id: string;
24
+ type: string;
25
+ text: string;
26
+ author_object_guid: string;
27
+ is_mine: boolean;
28
+ author_title: string;
29
+ author_type: string;
30
+ }
31
+ interface AbsObject {
32
+ object_guid: string;
33
+ type: string;
34
+ first_name: string;
35
+ avatar_thumbnail: AvatarThumbnail;
36
+ is_verified: boolean;
37
+ is_deleted: boolean;
38
+ }
39
+ interface Chat {
40
+ object_guid: string;
41
+ access: string[];
42
+ count_unseen: number;
43
+ is_mute: boolean;
44
+ is_pinned: boolean;
45
+ time_string: string;
46
+ last_message: LastMessage;
47
+ last_seen_my_mid: string;
48
+ last_seen_peer_mid: string;
49
+ status: string;
50
+ time: number;
51
+ abs_object: AbsObject;
52
+ is_blocked: boolean;
53
+ last_message_id: string;
54
+ last_deleted_mid: string;
55
+ }
56
+ interface UserInfo {
57
+ user: User;
58
+ chat: Chat;
59
+ timestamp: string;
60
+ can_receive_call: boolean;
61
+ can_video_call: boolean;
62
+ }
63
+ export default UserInfo;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import UserInfo from "./get_user_info";
2
+ import SendCode from "./send_code";
3
+ import SignIn from "./sign_in";
4
+ import FilterOption from "./filters_optiom";
5
+ import MessageUpdate from "./message_update";
6
+ import ChatUpdates from "./chat_updates";
7
+ import ShowNotifications from "./show_notifications";
8
+ import ShowActivities from "./show_activities";
9
+ export { UserInfo, SendCode, SignIn, FilterOption, MessageUpdate, ChatUpdates, ShowNotifications, ShowActivities };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,112 @@
1
+ interface FileInline {
2
+ file_id: number;
3
+ mime: string;
4
+ dc_id: number;
5
+ access_hash_rec: string;
6
+ file_name: string;
7
+ width?: number;
8
+ height?: number;
9
+ size: number;
10
+ type: string;
11
+ time?: number;
12
+ music_performer?: string;
13
+ is_round?: boolean;
14
+ is_spoil?: boolean;
15
+ }
16
+ interface ContactMessage {
17
+ phone_number: string;
18
+ first_name: string;
19
+ last_name: string;
20
+ user_guid: string;
21
+ vcard: string;
22
+ }
23
+ interface LiveData {
24
+ live_id: string;
25
+ thumb_inline: string;
26
+ access_token: string;
27
+ live_status: {
28
+ status: string;
29
+ play_count: number;
30
+ allow_comment: boolean;
31
+ can_play: boolean;
32
+ timestamp: string;
33
+ };
34
+ }
35
+ interface Location {
36
+ longitude: number;
37
+ latitude: number;
38
+ map_view: {
39
+ tile_side_count: number;
40
+ tile_urls: string[];
41
+ x_loc: number;
42
+ y_loc: number;
43
+ };
44
+ }
45
+ interface EventData {
46
+ type: string;
47
+ performer_object: {
48
+ type: string;
49
+ object_guid: string;
50
+ };
51
+ group_voice_chat_duration: number;
52
+ title: string;
53
+ avatar_thumbnail: Avatar;
54
+ avatar: Avatar;
55
+ }
56
+ interface Avatar {
57
+ file_id: string;
58
+ mime: string;
59
+ dc_id: string;
60
+ access_hash_rec: string;
61
+ }
62
+ interface PollData {
63
+ poll_id: string;
64
+ question: string;
65
+ options: string[];
66
+ poll_status: {
67
+ state: string;
68
+ selection_index: number;
69
+ percent_vote_options: number[];
70
+ total_vote: number;
71
+ show_total_votes: boolean;
72
+ };
73
+ is_anonymous: boolean;
74
+ type: string;
75
+ allows_multiple_answers: boolean;
76
+ }
77
+ interface Message {
78
+ message_id: string;
79
+ text?: string;
80
+ time: string;
81
+ is_edited: boolean;
82
+ type: string;
83
+ reply_to_message_id: string;
84
+ author_type: string;
85
+ author_object_guid: string;
86
+ allow_transcription?: boolean;
87
+ file_inline?: FileInline;
88
+ contact_message: ContactMessage;
89
+ live_data: LiveData;
90
+ poll: PollData;
91
+ location: Location;
92
+ event_data: EventData;
93
+ forwarded_from?: {
94
+ type_from: string;
95
+ message_id: string;
96
+ object_guid: string;
97
+ };
98
+ count_seen?: string;
99
+ thumb_inline?: string;
100
+ }
101
+ interface MessageUpdate {
102
+ message_id: string;
103
+ action: string;
104
+ message: Message;
105
+ updated_parameters: any[];
106
+ timestamp: string;
107
+ prev_message_id: string;
108
+ object_guid: string;
109
+ type: string;
110
+ state: string;
111
+ }
112
+ export default MessageUpdate;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ interface SendCode {
2
+ phone_code_hash: string;
3
+ status: string;
4
+ code_digits_count: number;
5
+ has_confirmed_recovery_email: boolean;
6
+ no_recovery_alert: string;
7
+ send_type: string;
8
+ hint_pass_key: string;
9
+ }
10
+ export default SendCode;