Skip to content

Commit 268d3ba

Browse files
committed
Instead of deleting existing commands, add deprecation notice to preserve backwards compatibility.
1 parent da604d8 commit 268d3ba

17 files changed

+840
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
99
- All Message field types dynamically search for an existing Command class that can handle them.
1010
### Deprecated
1111
- 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.
1213
### Removed
1314
### Fixed
1415
### Security
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Channel chat created command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class ChannelchatcreatedCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'channelchatcreated';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'Channel chat created';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Command execute method
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//$message = $this->getMessage();
46+
//$channel_chat_created = $message->getChannelChatCreated();
47+
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+
50+
return parent::execute();
51+
}
52+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Channel post command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class ChannelpostCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'channelpost';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'Handle channel post';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Execute command
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//$channel_post = $this->getUpdate()->getChannelPost();
46+
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+
49+
return parent::execute();
50+
}
51+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Chosen inline result command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class ChoseninlineresultCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'choseninlineresult';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'Chosen result query';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Command execute method
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//Information about chosen result is returned
46+
//$update = $this->getUpdate();
47+
//$inline_query = $update->getChosenInlineResult();
48+
//$query = $inline_query->getQuery();
49+
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+
52+
return parent::execute();
53+
}
54+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Delete chat photo command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class DeletechatphotoCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'deletechatphoto';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'Delete chat photo';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Command execute method
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//$message = $this->getMessage();
46+
//$delete_chat_photo = $message->getDeleteChatPhoto();
47+
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+
50+
return parent::execute();
51+
}
52+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Edited channel post command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class EditedchannelpostCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'editedchannelpost';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'Handle edited channel post';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Execute command
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//$edited_channel_post = $this->getUpdate()->getEditedChannelPost();
46+
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+
49+
return parent::execute();
50+
}
51+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Edited message command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class EditedmessageCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'editedmessage';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'User edited message';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Command execute method
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//$update = $this->getUpdate();
46+
//$edited_message = $update->getEditedMessage();
47+
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+
50+
return parent::execute();
51+
}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* This file is part of the TelegramBot package.
4+
*
5+
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Longman\TelegramBot\Commands\SystemCommands;
12+
13+
use Longman\TelegramBot\Commands\SystemCommand;
14+
15+
/**
16+
* Group chat created command
17+
*
18+
* @todo Remove due to deprecation!
19+
*/
20+
class GroupchatcreatedCommand extends SystemCommand
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $name = 'groupchatcreated';
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $description = 'Group chat created';
31+
32+
/**
33+
* @var string
34+
*/
35+
protected $version = '1.0.0';
36+
37+
/**
38+
* Command execute method
39+
*
40+
* @return mixed
41+
* @throws \Longman\TelegramBot\Exception\TelegramException
42+
*/
43+
public function execute()
44+
{
45+
//$message = $this->getMessage();
46+
//$group_chat_created = $message->getGroupChatCreated();
47+
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+
50+
return parent::execute();
51+
}
52+
}

0 commit comments

Comments
 (0)