zerobias / telegram-mtproto

Telegram client api (MTProto) library
MIT License
620 stars 136 forks source link

(node:9240) UnhandledPromiseRejectionWarning: Error: mtproto/then Not Found #175

Closed ThiPereira closed 6 years ago

ThiPereira commented 6 years ago

Hi!

I am trying to do a single teste. Here is my code?

const { MTProto } = require('lib')

const phone = { num : '+552199999999', //my phone code: '22222' //Do I need it???? }

const api = { layer : 57, initConnection : 0x69796de9, api_id : 000000 // my api code }

const server = { dev: true }

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 : 000000, //my api code api_hash : 'qwqwqwqwqwqwqwqwqwqwqw' //my api hash }) const { user } = await client('auth.signIn', { phone_number : phone.num, phone_code_hash: phone_code_hash, phone_code : phone.code })

console.log('signed as ', user) }

connect()


I am getting the following error?

(node:9240) UnhandledPromiseRejectionWarning: Error: mtproto/then Not Found at IncomingMessage.res.on (C:\telegram2\node_modules\lib\lib\remote.js:85:25 ) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) (node:9240) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:9240) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre cated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any ideias??

KylinWu commented 6 years ago

This telegram-mtproto have not maintained for a long time. It's currently quite unstable with all versions.

Try the official client library TDLib. Here is an awesome bindings for node.js called tdl.

ThiPereira commented 6 years ago

Hi @KylinWu I is very dificult to use TDLib!! A lot of packages to instal... Could you help me?