This commit is contained in:
hashbro
2026-08-07 06:26:49 +08:00
parent 1026ce1285
commit 03a40105fc
5 changed files with 42 additions and 6 deletions
@@ -2,6 +2,7 @@
namespace App\Telegram\Middleware;
use Illuminate\Support\Facades\Log;
use SergiX44\Nutgram\Nutgram;
class AuthorizedChat
@@ -10,11 +11,18 @@ class AuthorizedChat
{
$expected = (string) config('coruna.telegram.owner_chat_id', '');
if ($expected === '') {
Log::warning('telegram AuthorizedChat: TELEGRAM_OWNER_CHAT_ID empty');
return null;
}
$chatId = $bot->chatId();
if ($chatId === null || (string) $chatId !== $expected) {
Log::info('telegram AuthorizedChat: chat rejected', [
'chat_id' => $chatId,
'expected' => $expected,
]);
return null;
}