From 6669e7d278dcd65afc73819bc3d9e1dafdccc016 Mon Sep 17 00:00:00 2001 From: Jack'lul Date: Wed, 6 Feb 2019 18:58:07 +0100 Subject: [PATCH 1/2] Deprecate Botan integration (to be removed in future release) --- src/Botan.php | 4 ++++ src/BotanDB.php | 2 ++ src/Telegram.php | 24 +++--------------------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/Botan.php b/src/Botan.php index 03cc7201f..1285d0efb 100644 --- a/src/Botan.php +++ b/src/Botan.php @@ -18,6 +18,8 @@ /** * Class Botan * + * @deprecated Botan.io service is no longer working + * * Integration with http://botan.io statistics service for Telegram bots */ class Botan @@ -64,6 +66,8 @@ class Botan */ public static function initializeBotan($token, array $options = []) { + trigger_error('Longman\TelegramBot\Botan::initializeBotan is deprecated and will be removed in future release.', E_USER_DEPRECATED); + if (empty($token)) { throw new TelegramException('Botan token is empty!'); } diff --git a/src/BotanDB.php b/src/BotanDB.php index 6e0093044..ac1308aee 100644 --- a/src/BotanDB.php +++ b/src/BotanDB.php @@ -15,6 +15,8 @@ /** * Class BotanDB + * + * @deprecated Botan.io service is no longer working */ class BotanDB extends DB { diff --git a/src/Telegram.php b/src/Telegram.php index c08d836d3..8660e250b 100644 --- a/src/Telegram.php +++ b/src/Telegram.php @@ -123,13 +123,6 @@ class Telegram */ protected $last_command_response; - /** - * Botan.io integration - * - * @var boolean - */ - protected $botan_enabled = false; - /** * Check if runCommands() is running in this session * @@ -527,19 +520,9 @@ public function executeCommand($command) //Handle a generic command or non existing one $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) { - Botan::lock($command); - } - //execute() method is executed after preExecute() //This is to prevent executing a DB query without a valid connection $this->last_command_response = $command_obj->preExecute(); - - //Botan.io integration, send report after executing the command - if ($this->botan_enabled) { - Botan::track($this->update, $command); - } } return $this->last_command_response; @@ -905,16 +888,16 @@ protected function ucfirstUnicode($str, $encoding = 'UTF-8') /** * Enable Botan.io integration * + * @deprecated Botan.io service is no longer working + * * @param string $token * @param array $options * * @return \Longman\TelegramBot\Telegram - * @throws \Longman\TelegramBot\Exception\TelegramException */ public function enableBotan($token, array $options = []) { - Botan::initializeBotan($token, $options); - $this->botan_enabled = true; + trigger_error('Longman\TelegramBot\Telegram::enableBotan is deprecated and will be removed in future release.', E_USER_DEPRECATED); return $this; } @@ -947,7 +930,6 @@ public function runCommands($commands) } $this->run_commands = true; - $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands! $result = Request::getMe(); From 71e9ef963ca63bc96fdd38636e819b6f919b91ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20L=C3=BCscher?= Date: Thu, 7 Feb 2019 14:48:59 +0100 Subject: [PATCH 2/2] Add deprecation notice to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93fd4b3d0..5042d6a0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ### Added ### Changed ### Deprecated +- Botan.io service has been discontinued. ### Removed ### Fixed ### Security