defstudio / telegraph

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

No TelegraphChat defined for this request #438 #499

Closed HamasakiBrain closed 9 months ago

HamasakiBrain commented 9 months ago

yeah, telegraph requires chat() when replying

Originally posted by @fabio-ivona in https://github.com/defstudio/telegraph/discussions/438#discussioncomment-8132282

HamasakiBrain commented 9 months ago
public function handle(Request $request, TelegraphBot $bot): void
    {
        if(isset($request->message['contact'])) {

        }
        $text = $request->message['text'];
        if($text == '/start') {
            $this->start();
        };
    }
    public function start(): void
    {
        $this->service->reading();
        $buttons = [

        ];
        if ($this->service->isAdmin($this->chat->chat_id)) {
            $buttons[] = Button::make('Panel')->webApp(config('app.url'));
            $this->chat->message('Hello!')
                ->keyboard(Keyboard::make()->buttons($buttons))
                ->dispatch();
        } else {
            $keyboard = ReplyKeyboard::make()
                ->button('Share contact')->requestContact()
                ->oneTime();
            $buttons[] = Button::make('Начать регистрацию')->action('register');
            $this->chat->message("Привет")->replyKeyboard($keyboard)
                ->keyboard(Keyboard::make()->buttons($buttons))
                ->dispatch();
        }
    }

When 2 chats or more chats bot not working, error DefStudio\Telegraph\Exceptions\TelegraphException No TelegraphChat defined for this request

HamasakiBrain commented 9 months ago

Why closed issue ? This problem is not resolve @fabio-ivona

fabio-ivona commented 9 months ago

I can't help without a question or a description of your issue, sorry, please open another one describing what is not working