php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.9k stars 953 forks source link

Commands sent in Channel are error-prone #383

Closed ahmadazizi closed 7 years ago

ahmadazizi commented 7 years ago

If in a channel(not a group or supergroup) we send a /command , the command will be directed to GenericmessageCommand.php where in line 51 it tries a getFrom() on null which causes this error:

Call to a member function getFrom() on null in /vendor/longman/telegram-bot/src/Commands/SystemCommands/GenericmessageCommand.php:51

It shouldn't try getFrom() where in channel.

jacklul commented 7 years ago

You're probably not using newest version of the library, in the latest version channel messages are handled by ChannelpostCommand.

ahmadazizi commented 7 years ago

Thanks, just solved. The version defined in composer was ^0.35 which may was as a result of old instructions.