diff --git a/bot.php b/bot.php index a2b4142..b56119d 100644 --- a/bot.php +++ b/bot.php @@ -87,7 +87,11 @@ $telegram = new Longman\TelegramBot\Telegram( return; }; } -$mastodon = new MastodonClient(new Client); +try { + $mastodon = new MastodonClient(new Client); +} catch (\Exception $e) { + echo 'WARNING: could not start MastodonClient'; +} foreach ($articles as $article) { if (in_array($article['link'], $seen)) { @@ -130,7 +134,7 @@ foreach ($articles as $article) { echo $e; } } - if ($config['MASTODON'] === true) { + if ($config['MASTODON'] === true && isset($mastodon)) { $mastodon->domain($config['MASTODON_SERVER'])->token($config['MASTODON_ACCESS_TOKEN']); /* if ($image) {