@@ -191,7 +191,7 @@ class Core : public Http {
191
191
// ============================== TICK ==============================
192
192
// тикер, вызывать в loop. Вернёт true, если был обработан Update
193
193
bool tick () {
194
- if (!_state || !_token. length () ) return 0 ;
194
+ if (!_state) return 0 ;
195
195
196
196
// OTA
197
197
#ifndef FB_NO_FILE
@@ -261,6 +261,7 @@ class Core : public Http {
261
261
262
262
// отправить запрос на обновление
263
263
Result getUpdates (bool wait, bool allowLongPool = true ) {
264
+ if (!_token.length ()) return Result ();
264
265
FB_LOG (" getUpdates" );
265
266
Packet p (tg_cmd::getUpdates, _token);
266
267
if (_poll_mode == Poll::Long && allowLongPool) p[tg_api::timeout] = (uint16_t )(_poll_prd / 1000 );
@@ -307,6 +308,7 @@ class Core : public Http {
307
308
308
309
// отправить пакет
309
310
Result sendPacket (Packet& packet, bool wait = true , bool * sent = nullptr ) {
311
+ if (!_token.length ()) return Result ();
310
312
if (_poll_wait) {
311
313
_poll_wait = 0 ;
312
314
FB_LOG (" stop polling" );
@@ -335,6 +337,7 @@ class Core : public Http {
335
337
336
338
// получить путь к файлу относительно корня api
337
339
String getFilePath (Text fileID) {
340
+ if (!_token.length ()) return String ();
338
341
FB_LOG (" getFile" );
339
342
fb::Packet p (tg_cmd::getFile, _token);
340
343
p[tg_api::file_id] = fileID;
@@ -349,6 +352,7 @@ class Core : public Http {
349
352
350
353
// получить прямую ссылку на файл
351
354
String getFileLink (Text fileID) {
355
+ if (!_token.length ()) return String ();
352
356
String link = F (" https://" TELEGRAM_HOST " /file/bot" );
353
357
link += _token;
354
358
link += ' /' ;
0 commit comments