Command names should be lower case.

parent 45aa5f7a
......@@ -8,6 +8,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
- New entities, methods, update types and inline keyboard button for Payments (Bot API 3.0).
### Changed
- [:exclamation:][unreleased-correct-printerror] Corrected `ServerResponse->printError` method to print by default and return by setting `$return` parameter.
- Ensure command names are handled as lower case.
### Deprecated
### Removed
### Fixed
......
......@@ -20,7 +20,7 @@ class ChannelchatcreatedCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Channelchatcreated';
protected $name = 'channelchatcreated';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class ChannelpostCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Channelpost';
protected $name = 'channelpost';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class DeletechatphotoCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Deletechatphoto';
protected $name = 'deletechatphoto';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class EditedchannelpostCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Editedchannelpost';
protected $name = 'editedchannelpost';
/**
* @var string
......
......@@ -21,7 +21,7 @@ class GenericCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Generic';
protected $name = 'generic';
/**
* @var string
......
......@@ -22,7 +22,7 @@ class GenericmessageCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Genericmessage';
protected $name = 'genericmessage';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class GroupchatcreatedCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Groupchatcreated';
protected $name = 'groupchatcreated';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class LeftchatmemberCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Leftchatmember';
protected $name = 'leftchatmember';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class MigratefromchatidCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Migratefromchatid';
protected $name = 'migratefromchatid';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class MigratetochatidCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Migratetochatid';
protected $name = 'migratetochatid';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class NewchatmembersCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Newchatmembers';
protected $name = 'newchatmembers';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class NewchatphotoCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Newchatphoto';
protected $name = 'newchatphoto';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class NewchattitleCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Newchattitle';
protected $name = 'newchattitle';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class PinnedmessageCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Pinnedmessage';
protected $name = 'pinnedmessage';
/**
* @var string
......
......@@ -20,7 +20,7 @@ class SupergroupchatcreatedCommand extends SystemCommand
/**
* @var string
*/
protected $name = 'Supergroupchatcreated';
protected $name = 'supergroupchatcreated';
/**
* @var string
......
......@@ -470,16 +470,17 @@ class Telegram
*/
public function executeCommand($command)
{
$command = strtolower($command);
$command_obj = $this->getCommandObject($command);
if (!$command_obj || !$command_obj->isEnabled()) {
//Failsafe in case the Generic command can't be found
if ($command === 'Generic') {
if ($command === 'generic') {
throw new TelegramException('Generic command missing!');
}
//Handle a generic command or non existing one
$this->last_command_response = $this->executeCommand('Generic');
$this->last_command_response = $this->executeCommand('generic');
} else {
//Botan.io integration, make sure only the actual command user executed is reported
if ($this->botan_enabled) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment