Skip to content

Commit 7b5bf5f

Browse files
authored
Merge pull request #813 from customsoft/patch-1
Prevent redefine constant BASE_PATH
2 parents ed50346 + ff9823b commit 7b5bf5f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
66
## [Unreleased]
77
### Added
88
### Changed
9+
- [:exclamation:][unreleased-bc-rename-constants] Rename and ensure no redefinition of constants: `BASE_PATH` -> `TB_BASE_PATH`, `BASE_COMMANDS_PATH` -> `TB_BASE_COMMANDS_PATH`.
910
### Deprecated
1011
### Removed
1112
### Fixed

src/Telegram.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
namespace Longman\TelegramBot;
1212

13-
define('BASE_PATH', __DIR__);
14-
define('BASE_COMMANDS_PATH', BASE_PATH . '/Commands');
13+
defined('TB_BASE_PATH') || define('TB_BASE_PATH', __DIR__);
14+
defined('TB_BASE_COMMANDS_PATH') || define('TB_BASE_COMMANDS_PATH', TB_BASE_PATH . '/Commands');
1515

1616
use Exception;
1717
use Longman\TelegramBot\Commands\Command;
@@ -177,7 +177,7 @@ public function __construct($api_key, $bot_username = '')
177177
}
178178

179179
//Add default system commands path
180-
$this->addCommandsPath(BASE_COMMANDS_PATH . '/SystemCommands');
180+
$this->addCommandsPath(TB_BASE_COMMANDS_PATH . '/SystemCommands');
181181

182182
Request::initialize($this);
183183
}
@@ -461,7 +461,7 @@ public function processUpdate(Update $update)
461461

462462
//Load admin commands
463463
if ($this->isAdmin()) {
464-
$this->addCommandsPath(BASE_COMMANDS_PATH . '/AdminCommands', false);
464+
$this->addCommandsPath(TB_BASE_COMMANDS_PATH . '/AdminCommands', false);
465465
}
466466

467467
$type = $message->getType();

0 commit comments

Comments
 (0)