Skip to content

Deprecate Botan.io integration #925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/Botan.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!');
}
Expand Down
2 changes: 2 additions & 0 deletions src/BotanDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

/**
* Class BotanDB
*
* @deprecated Botan.io service is no longer working
*/
class BotanDB extends DB
{
Expand Down
24 changes: 3 additions & 21 deletions src/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();

Expand Down