Closed iamraccoon closed 8 years ago
All commands need to belong to the correct namespace. Your custom commands classes need to extend the type of command they are.
Look at the examples/commands folder for examples. e.g. MarkdownCommand.php
Thanks a lot, it's work!
But it is not logical. MarkdownCommand.php should have namespace examples\commands, not Longman\TelegramBot\Commands\UserCommands.
I thought we adhere to the standard PSR-0
The example commands are intended for copy-pasting, so that the namespaces are already set correctly 👍
Sorry for my English...
I can call addCommandsPath() in the Controller, but there is bug in Longman\TelegramBot\Telegram.php method getCommandObject() at line 243:
$command_namespace = __NAMESPACE__ . '\\Commands\\' . $auth . 'Commands\\' . $this->ucfirstUnicode($command) . 'Command';
NAMESPACE return only "Longman\TelegramBot". NAMESPACE never return my commands path.
So new Commands can be executions only they are located in a system folder like Longman\TelegramBot\Commands\SystemCommands.