php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.79k stars 949 forks source link

Processing messages from the group does not work #1419

Closed iyamk closed 8 months ago

iyamk commented 9 months ago

🐞 Bug Report

Required Information

? !
Operating system Name and version
PHP Telegram Bot version 0.81
PHP version 7.4
MySQL version none
Update Method Webhook
Self-signed certificate no
RAW update (if available) {...}

Summary

I need to process group messages but it doesn't work

Current behaviour

Messages in the group are not processed, but messages from the bot are processed

How to reproduce

Need files Commands/Group/GenericmessageCommand.php and Commands/Message/GenericmessageCommand.php Now send a message to the bot and it will process Commands/Group/GenericmessageCommand.php and if the bot is in a group it will not respond to messages at all

Expected behaviour

Since it shouldn't be now, this is a serious bug and it has interrupted my development now

jacklul commented 9 months ago

Does the bot shows "has access to messages" on the members list? Sometimes when you toggle the group privacy settings in BotFather you gotta readd the bot.

Hitmare commented 8 months ago

First as jacklul said, please check if the privacy settings from the bot is turned off. otherwise telegram will not send any non-command messages to the bot

second: you can't use two GenericmessageCommand.php in your Command Folder , regardless of the subfolder. if you need the function of Commands/Group/GenericmessageCommand.php and Commands/Message/GenericmessageCommand.php please merge them to one file.

https://github.com/php-telegram-bot/example-bot/blob/master/config.example.php#L46-L47 https://github.com/php-telegram-bot/example-bot/blob/master/Commands/README.MD https://github.com/php-telegram-bot/example-bot/blob/master/CustomCommands/README.md

iyamk commented 8 months ago

Yes, I forgot about the privacy settings and that's why it didn't work.

iyamk commented 8 months ago

First as jacklul said, please check if the privacy settings from the bot is turned off. otherwise telegram will not send any non-command messages to the bot

second: you can't use two GenericmessageCommand.php in your Command Folder , regardless of the subfolder. if you need the function of Commands/Group/GenericmessageCommand.php and Commands/Message/GenericmessageCommand.php please merge them to one file.

https://github.com/php-telegram-bot/example-bot/blob/master/config.example.php#L46-L47 https://github.com/php-telegram-bot/example-bot/blob/master/Commands/README.MD https://github.com/php-telegram-bot/example-bot/blob/master/CustomCommands/README.md

Yes, they really conflict and everything worked on one file with a check that the chat_id is the id of the group