Closed kamil-malinski closed 1 year ago
Thanks! I will take a look after work.
Fixed. Please check it out. Thanks for your info.
thank you for the update
I added the bot to a group and it doesn't respond to anything in the group, even if I directly address the bot
as soon as I make the bot an admin of the group, it crashes with:
file:///root/halbot/node_modules/utilitas/lib/bot.mjs:67
if (msg.new_chat_member.user === ctx.botInfo.id
^
TypeError: Cannot read properties of undefined (reading 'new_chat_member')
at file:///root/halbot/node_modules/utilitas/lib/bot.mjs:67:25
at execute (/root/halbot/node_modules/telegraf/lib/composer.js:485:23)
at /root/halbot/node_modules/telegraf/lib/composer.js:486:27
at execute (/root/halbot/node_modules/telegraf/lib/composer.js:485:23)
at /root/halbot/node_modules/telegraf/lib/composer.js:486:27
at /root/halbot/node_modules/telegraf/lib/future.js:145:16
at execute (/root/halbot/node_modules/telegraf/lib/composer.js:485:23)
at /root/halbot/node_modules/telegraf/lib/composer.js:486:27
at /root/halbot/node_modules/telegraf/lib/composer.js:161:31
at execute (/root/halbot/node_modules/telegraf/lib/composer.js:485:23)
if I restart the bot after I made it admin, it responds in the group, but just once, after that every reply is being ignored and I see
[BOT 2023-03-27T09:25:35.913Z] Missing response.
in the log
TypeError: Cannot read properties of undefined (reading 'new_chat_member')
This is not the right version of utilities. Please update all the depending packages or reinstall the latest halbot. :)
If you see this after you update to the latest version, please come back and let me know, thanks!
if I restart the bot after I made it admin, it responds in the group, but just once, after that every reply is being ignored and I see
[BOT 2023-03-27T09:25:35.913Z] Missing response.
in the log
It's OK to see this line of logs. Because telegram will send lots of system messages to the bot client, not all the messages need to be parsed and replied to. I ignored some of the messages from the system, which will show this log that tell us the bot receiving messages.
@kamil-malinski
1st, You have to give the bot permission to access the messages in the group, which means you need to give the bot admin role. That is a limitation of telegram APIs.
2nd, Halbot will only reply to messages when it has been mentioned in a group, not all the messages by default. You can let it reply to all the messages in a group. That will be a bit crazy, but you can do it if you want by adding the group
keyword to the chatType
array of the config file.
Hi!
If I add the bot to a group, the bot crashes: