Open IKA-Syrian opened 2 years ago
Please provide reproducable code
To reproduce:
1) Fire up the "ping" sample. 2) Create a telegram channel (in my case it was a private channel, but I doubt it matters). 3) add the bot to the channel. Allow it to receive messages. 4) send any message on the channel. 5) watch the poor bot die.
If you change line 93 to:
if(data.from !=null)
this.member = this.chat.members.add(this.chat.id, { id: data.from.id, extras: [{ user: data.from }] });
Then channel messages work.
I think that channel messages are just from the channel, not from a user.
/home/darkmen/Telegram-bot/node_modules/@yuva1422/telegram.js/src/structures/Message.js:93 this.member = this.chat.members.add(this.chat.id, { id: data.from.id, extras: [{ user: data.from }] }); ^
TypeError: Cannot read properties of undefined (reading 'id') at Message._patch (/home/darkmen/Telegram-bot/node_modules/@yuva1422/telegram.js/src/structures/Message.js:93:71) at new Message (/home/darkmen/Telegram-bot/node_modules/@yuva1422/telegram.js/src/structures/Message.js:41:20) at WorkerClient.onMessage (/home/darkmen/Telegram-bot/node_modules/@yuva1422/telegram.js/src/client/WorkerClient.js:39:21) at WorkerClient.processUpdate (/home/darkmen/Telegram-bot/node_modules/@yuva1422/telegram.js/src/client/WorkerClient.js:27:12) at /home/darkmen/Telegram-bot/node_modules/@yuva1422/telegram.js/src/client/PollingClient.js:50:30 at processTicksAndRejections (node:internal/process/task_queues:96:5) [nodemon] app crashed - waiting for file changes before starting...