Unverified Commit 0f8e0275 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #925 from jacklul/rip_botan

Deprecate Botan.io integration
parents 2cfb8a7e 71e9ef96
......@@ -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
......
......@@ -18,6 +18,8 @@ use Longman\TelegramBot\Exception\TelegramException;
/**
* 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!');
}
......
......@@ -15,6 +15,8 @@ use Longman\TelegramBot\Exception\TelegramException;
/**
* Class BotanDB
*
* @deprecated Botan.io service is no longer working
*/
class BotanDB extends DB
{
......
......@@ -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 @@ class Telegram
//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 @@ class Telegram
/**
* 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 @@ class Telegram
}
$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();
......
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