Skip to content

Commit b923744

Browse files
authored
Added log debug telegram captcha (#278)
1 parent c6e0547 commit b923744

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/Http/Controllers/WebHookController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Jobs\TelegramMessage;
66
use App\Services\Telegram\CaptchaCallback;
77
use Illuminate\Http\Request;
8+
use Illuminate\Support\Facades\Log;
89

910
class WebHookController extends Controller
1011
{
@@ -30,6 +31,8 @@ public function telegram(Request $request): void
3031
);
3132
}
3233

34+
Log::channel('telegram')->info(json_encode($request->all()));
35+
3336
TelegramMessage::dispatch(
3437
$request->collect('message'),
3538
$captcha,

app/Jobs/TelegramMessage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Support\Collection;
1414
use Illuminate\Support\Facades\App;
1515
use Illuminate\Support\Facades\Cache;
16+
use Illuminate\Support\Facades\Log;
1617

1718
class TelegramMessage implements ShouldQueue
1819
{
@@ -41,11 +42,15 @@ public function __construct(public Collection $message, public ?CaptchaCallback
4142
$this->from = $this->message->dot()->get('from.id');
4243
$this->newChatMember = (bool) $this->message->get('new_chat_member');
4344

45+
Log::channel('telegram')->info('CHAT MEMBER CONSTRUCTOR:'.$this->newChatMember);
46+
4447
$chatConfig = collect(config('telegram.chats'))
4548
->where('id', $this->chatId)
4649
->first();
4750

4851
$this->locale = $chatConfig ? $chatConfig['locale'] : config('telegram.default_locale');
52+
53+
Log::channel('telegram')->info("TG Message Locale: $this->locale| TG Message chat:".json_encode($chatConfig));
4954
}
5055

5156
/**
@@ -55,6 +60,7 @@ public function handle(TelegramBot $telegramBot): void
5560
{
5661
// Ban new user without duration and send captcha button
5762
if ($this->newChatMember) {
63+
Log::channel('telegram')->info('NEW CHAT MEMBER IF');
5864
App::setLocale($this->locale);
5965
$telegramBot->banUserInGroup($this->chatId, $this->from);
6066
$telegramBot->sendWelcomeButton($this->chatId, $this->from, $this->firstName);

0 commit comments

Comments
 (0)