catch masto errors

This commit is contained in:
Aleksandr Yakovlev 2024-10-07 08:30:56 +06:00
parent fe3a6cca86
commit 6570852c6b
No known key found for this signature in database
GPG key ID: 8269E24B4008E32A

View file

@ -87,7 +87,11 @@ $telegram = new Longman\TelegramBot\Telegram(
return;
};
}
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) {