This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed bug with Cyrillic text encoding * Fixed bug with several broken methods invocations * Optimized authorization performance * Added fix for automatic base data center selection
- Loading branch information
Showing
38 changed files
with
2,077 additions
and
817 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
lib/** | ||
es/** | ||
dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 2.2.2 | ||
* Fixed bug with cyrillic text encoding | ||
* Fixed bug with several broken methods invocations | ||
* Optimized authorization performance | ||
* Added fix for automatic base data center selection by [@goodmind][] | ||
|
||
# 2.2.1 | ||
* Flag (optional type) fields now acts like common fields. | ||
* Zeroes, empty strings and empty types now can be omited. write only useful fields. | ||
* *invokeWithLayer* api field now may detects internally and don't required (but still valid). | ||
* Type check argument fields | ||
* Fix auth race condition | ||
* Add batch async logger | ||
|
||
# 2.2.0 | ||
|
||
* **breaking** Instance now creates without `new` | ||
* **breaking** Rename module exports from `ApiManager` to `MTProto` | ||
|
||
# =<2.1.0 | ||
|
||
Several early alpha versions based on new architechture | ||
|
||
--- | ||
|
||
# 1.1.0 *(beta)* | ||
|
||
* **breaking** Remove all functions from response. Just use the field values. | ||
* Remove logger from response | ||
* Add changelog.md | ||
|
||
# 1.0.6 *(beta)* | ||
|
||
* Https connection. Usage: | ||
```javascript | ||
const { network } = require('telegram-mtproto') | ||
const connection = network.http({ host: 'ip', port: '80', protocol: 'https' }) | ||
``` | ||
* Websockets connection. Usage: | ||
```javascript | ||
const connection = network.wc({ host: 'ip', port: '80' }) | ||
``` | ||
* Precision timing | ||
* Major performance boost | ||
|
||
[@goodmind]: https://github.com/goodmind/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const { MTProto } = require('../lib') | ||
|
||
const phone = { | ||
num : '+9996620001', | ||
code: '22222' | ||
} | ||
|
||
const api = { | ||
layer : 57, | ||
initConnection: 0x69796de9, | ||
api_id : 49631 | ||
} | ||
|
||
const server = { | ||
dev: true //We will connect to the test server. | ||
} //Any empty configurations fields can just not be specified | ||
|
||
const client = MTProto({ server, api }) | ||
|
||
async function connect(){ | ||
const { phone_code_hash } = await client('auth.sendCode', { | ||
phone_number : phone.num, | ||
current_number: false, | ||
api_id : 49631, | ||
api_hash : 'fb050b8f6771e15bfda5df2409931569' | ||
}) | ||
const { user } = await client('auth.signIn', { | ||
phone_number: phone.num, | ||
phone_code_hash, | ||
phone_code : phone.code | ||
}) | ||
|
||
console.log('signed as ', user) | ||
} | ||
|
||
connect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
const login = require('./login') | ||
const { getChat, chatHistory } = require('./chat-history') | ||
const { getChat, chatHistory, searchUsers } = require('./chat-history') | ||
const updateProfile = require('./update-profile') | ||
|
||
const run = async () => { | ||
await login() | ||
const chat = await getChat() | ||
await chatHistory(chat) | ||
const first_name = await login() | ||
const res = await searchUsers() | ||
await updateProfile(first_name) | ||
// const chat = await getChat() | ||
// await chatHistory(chat) | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const telegram = require('./init') | ||
|
||
const updateProfile = async (currentName) => { | ||
const result = await telegram('account.updateProfile', { | ||
first_name: 'lam'//currentName + 'test' | ||
}) | ||
console.log('updateProfile', result) | ||
return result | ||
} | ||
|
||
module.exports = updateProfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.