Skip to content

Commit 0f8e027

Browse files
authored
Merge pull request #925 from jacklul/rip_botan
Deprecate Botan.io integration
2 parents 2cfb8a7 + 71e9ef9 commit 0f8e027

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
77
### Added
88
### Changed
99
### Deprecated
10+
- Botan.io service has been discontinued.
1011
### Removed
1112
### Fixed
1213
### Security

src/Botan.php

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
/**
1919
* Class Botan
2020
*
21+
* @deprecated Botan.io service is no longer working
22+
*
2123
* Integration with http://botan.io statistics service for Telegram bots
2224
*/
2325
class Botan
@@ -64,6 +66,8 @@ class Botan
6466
*/
6567
public static function initializeBotan($token, array $options = [])
6668
{
69+
trigger_error('Longman\TelegramBot\Botan::initializeBotan is deprecated and will be removed in future release.', E_USER_DEPRECATED);
70+
6771
if (empty($token)) {
6872
throw new TelegramException('Botan token is empty!');
6973
}

src/BotanDB.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* Class BotanDB
18+
*
19+
* @deprecated Botan.io service is no longer working
1820
*/
1921
class BotanDB extends DB
2022
{

src/Telegram.php

+3-21
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,6 @@ class Telegram
123123
*/
124124
protected $last_command_response;
125125

126-
/**
127-
* Botan.io integration
128-
*
129-
* @var boolean
130-
*/
131-
protected $botan_enabled = false;
132-
133126
/**
134127
* Check if runCommands() is running in this session
135128
*
@@ -527,19 +520,9 @@ public function executeCommand($command)
527520
//Handle a generic command or non existing one
528521
$this->last_command_response = $this->executeCommand('generic');
529522
} else {
530-
//Botan.io integration, make sure only the actual command user executed is reported
531-
if ($this->botan_enabled) {
532-
Botan::lock($command);
533-
}
534-
535523
//execute() method is executed after preExecute()
536524
//This is to prevent executing a DB query without a valid connection
537525
$this->last_command_response = $command_obj->preExecute();
538-
539-
//Botan.io integration, send report after executing the command
540-
if ($this->botan_enabled) {
541-
Botan::track($this->update, $command);
542-
}
543526
}
544527

545528
return $this->last_command_response;
@@ -905,16 +888,16 @@ protected function ucfirstUnicode($str, $encoding = 'UTF-8')
905888
/**
906889
* Enable Botan.io integration
907890
*
891+
* @deprecated Botan.io service is no longer working
892+
*
908893
* @param string $token
909894
* @param array $options
910895
*
911896
* @return \Longman\TelegramBot\Telegram
912-
* @throws \Longman\TelegramBot\Exception\TelegramException
913897
*/
914898
public function enableBotan($token, array $options = [])
915899
{
916-
Botan::initializeBotan($token, $options);
917-
$this->botan_enabled = true;
900+
trigger_error('Longman\TelegramBot\Telegram::enableBotan is deprecated and will be removed in future release.', E_USER_DEPRECATED);
918901

919902
return $this;
920903
}
@@ -947,7 +930,6 @@ public function runCommands($commands)
947930
}
948931

949932
$this->run_commands = true;
950-
$this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands!
951933

952934
$result = Request::getMe();
953935

0 commit comments

Comments
 (0)