I am trying to make a telegram bot using their apis and MTProto.
I imported telegram-mtproto
into my code and received an error:
ERROR in ./node_modules/telegram-mtproto/es/worker.js (./node_modules/worker-loader?inline!./node_modules/telegram-mtproto/es/worker.js)
Module build failed (from ./node_modules/worker-loader/index.js):
TypeError: Cannot read property 'context' of undefined
at Object.pitch (/Volumes/Work/Work/React/Lotteo/loteo-web/node_modules/worker-loader/index.js:32:46)
@ ./node_modules/telegram-mtproto/es/crypto.js 53:18-61
@ ./node_modules/telegram-mtproto/es/index.js
@ ./src/common/utils/initializers.ts
@ ./src/common/utils/index.ts
@ ./src/logger/rollbar.ts
@ ./src/logger/index.ts
@ ./src/index.tsx
@ multi (webpack)-dev-server/client?http://0.0.0.0:3000 (webpack)/hot/dev-server.js ./src
Here is my code:
const MTProto = require('telegram-mtproto').default;
const telPhone = { num : '', code: '' };
const api = { layer : '', initConnection : '', api_id : '' };
const server = { dev: true };
const client = MTProto({ server, api });
I'm not sure what is wrong with it after adding telegram-mtproto
package?