diff --git a/src/Request.php b/src/Request.php index de663f41..6d90b614 100644 --- a/src/Request.php +++ b/src/Request.php @@ -323,6 +323,10 @@ 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;