php-telegram-bot / core

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

Can't have more than 1 class for generics messages #1428

Open mtalaeii opened 7 months ago

mtalaeii commented 7 months ago

🐞 Bug Report

Required Information

? !
Operating system Ubuntu 22
PHP Telegram Bot version 0.81.0
PHP version 8.2.9
MySQL version mariadb 11
Update Method Webhook
Self-signed certificate no

Summary

This bug is very bad bug actually i want have more than 1 class for generic message .

Current behaviour

This is necessary that the class name is GenericmessageCommand and the $name is genericmessasge to execute generic commands this is my code

class ManagechannelsCommand extends SystemCommand
{
    protected $private_only = true;
    protected $name = 'managechannels';

    /**
     * @inheritDoc
     */
    public function execute(): ServerResponse
    {
        if ($this->getMessage()->getText(true) != '.....') {
            return Request::emptyResponse();
        }
        ......
        return $this->replyToUser('.......');
    }
}

Expected behaviour

I expecte if we dont have usage then the class maybe is one of genericmessage command classes then its just executed with any type of message

Hitmare commented 2 weeks ago

Hello

Do you still need help with this issue?