-
-
Notifications
You must be signed in to change notification settings - Fork 964
Unable to set custom Genericmessage handler #749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Extend Telegram class and overwrite |
This do NOT work. Let me explain:
Is this explanation enought to confirm the bug? The docs says to use this way, you said to use this way, but it do not work. I've checked it again and it do not work. |
@speller What are you trying to achieve here? To use your own version of Or does this not work for you? |
getCommandsList() is called first and it loads all "command like" files from those paths in order, when these files are loaded, so are the classes within and if you were to define a custom generic message in a path that is before the default one and it is placed in the same namespace (namespace Longman\TelegramBot\Commands\SystemCommands;), getCommandObject will return an instance of that class. |
The only way this technique will work if I will set my own class within the same namespace as system one |
I really do not like the way ALL command files are loaded for just one to be executed, but that is a very core piece and isn't a quick change. |
@sharkydog Absolutely agree with that. Also, implementing a new commands system will literally break ALL user commands, requiring every user to recode their commands (to some degree) 😖 But it is inevitable to go forward... |
Hi, I'm new to this package.
The issue: when new message is received, the Telegram class is always pick its default
Longman\TelegramBot\Commands\SystemCommands\GenericmessageCommand
class (that always returns empty response) in theTelegram::getCommandObject
method. It do not use the$commands_paths
field at all to find command handler in any custom paths. When we use composer the following codewill always find default implementation because
class_exists("Longman\TelegramBot\Commands\SystemCommands\GenericmessageCommand")
will ALWAYS return true on the first foreach loop.So my question is: HOW to set up my own command handler and do not use any of the default implementation?
The text was updated successfully, but these errors were encountered: