Keep Tokenview and Telegram running when log files are not writable.
Daily logs created by root cron were blocking www from appending, which aborted webhook ingest and bot pushes. File channels now use 0664 plus exception-safe stacks, and writes go through SafeLog. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Telegram\Handlers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Support\SafeLog;
|
||||
use SergiX44\Nutgram\Nutgram;
|
||||
use SergiX44\Nutgram\Telegram\Properties\ChatMemberStatus;
|
||||
use SergiX44\Nutgram\Telegram\Properties\ChatType;
|
||||
@@ -60,7 +60,7 @@ class JoinedChatHandler
|
||||
),
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
Log::channel('telegram')->warning('telegram join announce failed: '.$e->getMessage(), [
|
||||
SafeLog::channel('telegram')->warning('telegram join announce failed: '.$e->getMessage(), [
|
||||
'chat_id' => $chatId,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Telegram\Middleware;
|
||||
|
||||
use App\Support\SafeLog;
|
||||
use App\Telegram\TelegramBotContext;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use SergiX44\Nutgram\Nutgram;
|
||||
use SergiX44\Nutgram\Telegram\Properties\ChatType;
|
||||
|
||||
@@ -21,7 +21,7 @@ class AuthorizedChat
|
||||
{
|
||||
$chatId = $bot->chatId();
|
||||
if (! $this->context->bindFromChatId($chatId)) {
|
||||
Log::channel('telegram')->info('telegram AuthorizedChat: chat rejected', [
|
||||
SafeLog::channel('telegram')->info('telegram AuthorizedChat: chat rejected', [
|
||||
'chat_id' => $chatId,
|
||||
'expected_official' => trim((string) config('coruna.telegram.owner_chat_id', '')),
|
||||
]);
|
||||
@@ -32,7 +32,7 @@ class AuthorizedChat
|
||||
$type = $bot->chat()?->type;
|
||||
$typeValue = $type instanceof ChatType ? $type->value : (string) $type;
|
||||
if (! in_array($typeValue, [ChatType::GROUP->value, ChatType::SUPERGROUP->value, 'group', 'supergroup'], true)) {
|
||||
Log::channel('telegram')->info('telegram AuthorizedChat: not a group chat', [
|
||||
SafeLog::channel('telegram')->info('telegram AuthorizedChat: not a group chat', [
|
||||
'chat_id' => $chatId,
|
||||
'type' => $typeValue,
|
||||
]);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Telegram\Middleware;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Support\SafeLog;
|
||||
use SergiX44\Nutgram\Nutgram;
|
||||
use SergiX44\Nutgram\Telegram\Properties\ChatMemberStatus;
|
||||
use SergiX44\Nutgram\Telegram\Properties\ChatType;
|
||||
@@ -24,7 +24,7 @@ class GroupAdminOnly
|
||||
$type = $bot->chat()?->type;
|
||||
$typeValue = $type instanceof ChatType ? $type->value : (string) $type;
|
||||
if (! in_array($typeValue, [ChatType::GROUP->value, ChatType::SUPERGROUP->value, 'group', 'supergroup'], true)) {
|
||||
Log::channel('telegram')->info('telegram GroupAdminOnly: rejected non-group chat', [
|
||||
SafeLog::channel('telegram')->info('telegram GroupAdminOnly: rejected non-group chat', [
|
||||
'chat_id' => $chatId,
|
||||
'type' => $typeValue,
|
||||
]);
|
||||
@@ -35,7 +35,7 @@ class GroupAdminOnly
|
||||
try {
|
||||
$member = $bot->getChatMember($chatId, $userId);
|
||||
} catch (\Throwable $e) {
|
||||
Log::channel('telegram')->warning('telegram GroupAdminOnly: getChatMember failed', [
|
||||
SafeLog::channel('telegram')->warning('telegram GroupAdminOnly: getChatMember failed', [
|
||||
'chat_id' => $chatId,
|
||||
'user_id' => $userId,
|
||||
'error' => $e->getMessage(),
|
||||
|
||||
Reference in New Issue
Block a user