core icon indicating copy to clipboard operation
core copied to clipboard

Make sure setCustomBotApiUri has an effect if Telegram object was already instantiated.

Open TiiFuchs opened this issue 3 years ago • 2 comments

Should fix problems like #1295

TiiFuchs avatar Mar 18 '22 08:03 TiiFuchs

@noplanman What do you think?

TiiFuchs avatar Mar 18 '22 08:03 TiiFuchs

We have a few difficulties with finding the right way here, because you also can set a Guzzle Client yourself with Request::setClient() and this should always take precedence over custom settings, like the base_uri we're setting in setCustomBotApiUri().

For now I added a check that looks, if there is already a client and throws an TelegramException, so we get an Exception if we set the custom Bot API URI after instantiating the Telegram class with an understandable error that helps solve the problem directly.

If you use your own Guzzle Client, you need to set the base_uri accordingly yourself!

TiiFuchs avatar Mar 20 '22 15:03 TiiFuchs