defstudio / telegraph

Telegraph is a Laravel package for fluently interacting with Telegram Bots
MIT License
675 stars 116 forks source link

No TelegraphChat defined for this request #504

Closed HamasakiBrain closed 7 months ago

HamasakiBrain commented 8 months ago

My code is working when 1 chat in Database. When i send message on my bot from other account telegraph report No telegraphChat defined for this request. My handler on screen 1. image

My telegraph config file. image

HamasakiBrain commented 8 months ago

@fabio-ivona help please)

fabio-ivona commented 8 months ago

@HamasakiBrain could you check the value of $this->chat and paste here your error stacktrace?

HamasakiBrain commented 8 months ago

@HamasakiBrain could you check the value of $this->chat and paste here your error stacktrace?

image image

When Log::debug($this->chat); Typed property DefStudio\Telegraph\Handlers\WebhookHandler::$chat must not be accessed before initialization

HamasakiBrain commented 8 months ago

@fabio-ivona

fabio-ivona commented 8 months ago

@HamasakiBrain the exception triggers in app/Telegram/Service.php

so it's outside Telegraph source code

probably you are calling telegraph API that requires a chat to be set up, you should do it

basically: when there is a single chat registered in your db, Telegraph loads it assuming it is the only possible one. But you have two chats, so you should pass the chat to your Service (using $this->chat in your Handler)

HamasakiBrain commented 8 months ago

@fabio-ivona I've removed this code, but it doesn't work without it. No TelegraphChat defined for this request

fabio-ivona commented 8 months ago

what code did you removed?

HamasakiBrain commented 8 months ago

what code did you removed?

$this->service->reading()

fabio-ivona commented 8 months ago

So, now, what is the updated stack trace?

HamasakiBrain commented 8 months ago

So, now, what is the updated stack trace?

The same mistake remained. No TelegraphChat defined for this request

fabio-ivona commented 8 months ago

Sorry @HamasakiBrain ,can't help anymore without proper info

The previous stack trace triggered in one of your classes, now that you removed that call, I need the new stack trace in order to detect where the issue is triggered