diff --git a/src/Request.php b/src/Request.php index 599a437a..6d90b614 100644 --- a/src/Request.php +++ b/src/Request.php @@ -323,14 +323,14 @@ public static function setClient(ClientInterface $client): void */ public static function setCustomBotApiUri(string $api_base_uri, string $api_base_download_uri = ''): void { + if (self::$client) { + throw new TelegramException('setCustomBotApiUri() needs to be called before the Telegram object gets instantiated.'); + } + self::$api_base_uri = $api_base_uri; if ($api_base_download_uri !== '') { self::$api_base_download_uri = $api_base_download_uri; } - - if (self::$telegram) { - self::initialize(self::$telegram); - } } /**