Comparing version 1.0.2 to 1.0.3
18
cli.js
@@ -7,14 +7,8 @@ #!/usr/bin/env node | ||
/** | ||
* Setting default env from public data on github | ||
* Setting default API_ID and API_HASH from public data on github | ||
* https://github.com/zhukov/webogram/blob/master/app/js/lib/config.js | ||
*/ | ||
process.env.API_ID = "2496" | ||
process.env.API_HASH = "8da85b0d5bfe62527e5b244c209159c3" | ||
const API_ID = 2496 | ||
const API_HASH = "8da85b0d5bfe62527e5b244c209159c3" | ||
startSession().then((listener) => { | ||
listener.on("UpdateShortMessage", (event) => { | ||
console.log(event) | ||
}) | ||
}) | ||
eventEmitter | ||
@@ -36,1 +30,7 @@ .on("RequiresPhoneNumber", (phoneNumberEmitter) => { | ||
}) | ||
startSession({ apiId: API_ID, apiHash: API_HASH }).then((listener) => { | ||
listener.on("UpdateShortMessage", (event) => { | ||
console.log(event) | ||
}) | ||
}) |
{ | ||
"name": "plaintl", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A plain telegram listener", | ||
@@ -32,7 +32,7 @@ "main": "./src/index.mjs", | ||
"dependencies": { | ||
"dotenv": "^12.0.3", | ||
"input": "^1.0.1", | ||
"telegram": "^2.3.0", | ||
"envfile": "^6.17.0", | ||
"lodash": "^4.17.21" | ||
"lodash": "^4.17.21", | ||
"telegram": "^2.3.0" | ||
} | ||
} |
@@ -23,13 +23,2 @@ # PlainTL | ||
### Preparation | ||
Rename `.sample.env` to `.env` and then set your environment values. | ||
```bash | ||
API_ID="YOUR_API_ID" | ||
API_HASH="YOUR_API_HASH" | ||
``` | ||
Obtain `API_ID` and `API_HASH` from [here](https://my.telegram.org/auth). | ||
### Usage | ||
@@ -48,6 +37,21 @@ | ||
.on("RequiresPassword", (passwordEmitter) => { | ||
passwordEmitter("my-password") | ||
passwordEmitter("password") | ||
}) | ||
.on("RequiresFirstAndLastNames", (firstAndLastNamesEmitter) => { | ||
firstAndLastNamesEmitter(["First name", "Last name"]) | ||
}) | ||
``` | ||
Preparing provider [options](https://github.com/dalirnet/plaintl/blob/main/src/index.mjs#L117-L120). | ||
> Obtain `API_ID` and `API_HASH` from [here](https://my.telegram.org/auth). | ||
```javascript | ||
const providerOptions = { | ||
apiId: "API_ID", | ||
apiHash: "API_HASH", | ||
forceSMS: false, | ||
} | ||
``` | ||
Start `PlainTL` session. | ||
@@ -57,6 +61,6 @@ | ||
// async | ||
const listener = await startSession() | ||
const listener = await startSession(providerOptions) | ||
// sync | ||
startSession().then((listener) => {}) | ||
startSession(providerOptions).then((listener) => {}) | ||
``` | ||
@@ -63,0 +67,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
190
13
59512
221
+ Addeddotenv@^12.0.3
+ Addeddotenv@12.0.4(transitive)
- Removedenvfile@^6.17.0
- Removedenvfile@6.22.0(transitive)