Skip to content

Commit 0efd567

Browse files
authored
Merge pull request #940 from noplanman/920-new_system_commands
Autoselect SystemCommand from existing Commands
2 parents 663acfc + 6837bb9 commit 0efd567

18 files changed

+83
-28
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
66
## [Unreleased]
77
### Added
88
### Changed
9+
- All Message field types dynamically search for an existing Command class that can handle them.
910
### Deprecated
1011
- Botan.io service has been discontinued.
12+
- Most built-in System Commands will be handled by GenericmessageCommand by default in a future release and will require a custom implementation.
1113
### Removed
1214
### Fixed
1315
- Constraint errors in `/cleanup` command.

src/Commands/SystemCommands/ChannelchatcreatedCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Channel chat created command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class ChannelchatcreatedCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$channel_chat_created = $message->getChannelChatCreated();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/ChannelpostCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Channel post command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class ChannelpostCommand extends SystemCommand
1921
{
@@ -42,6 +44,8 @@ public function execute()
4244
{
4345
//$channel_post = $this->getUpdate()->getChannelPost();
4446

47+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
48+
4549
return parent::execute();
4650
}
4751
}

src/Commands/SystemCommands/ChoseninlineresultCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Chosen inline result command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class ChoseninlineresultCommand extends SystemCommand
1921
{
@@ -45,6 +47,8 @@ public function execute()
4547
//$inline_query = $update->getChosenInlineResult();
4648
//$query = $inline_query->getQuery();
4749

50+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
51+
4852
return parent::execute();
4953
}
5054
}

src/Commands/SystemCommands/DeletechatphotoCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Delete chat photo command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class DeletechatphotoCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$delete_chat_photo = $message->getDeleteChatPhoto();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/EditedchannelpostCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Edited channel post command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class EditedchannelpostCommand extends SystemCommand
1921
{
@@ -42,6 +44,8 @@ public function execute()
4244
{
4345
//$edited_channel_post = $this->getUpdate()->getEditedChannelPost();
4446

47+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
48+
4549
return parent::execute();
4650
}
4751
}

src/Commands/SystemCommands/EditedmessageCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Edited message command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class EditedmessageCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$update = $this->getUpdate();
4446
//$edited_message = $update->getEditedMessage();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/GroupchatcreatedCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Group chat created command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class GroupchatcreatedCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$group_chat_created = $message->getGroupChatCreated();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/LeftchatmemberCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Left chat member command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class LeftchatmemberCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$member = $message->getLeftChatMember();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/MigratefromchatidCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Migrate from chat id command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class MigratefromchatidCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$migrate_from_chat_id = $message->getMigrateFromChatId();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

0 commit comments

Comments
 (0)