defstudio / telegraph

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

local.ERROR: No TelegraphChat defined for this request #440

Closed SawyerUA closed 11 months ago

SawyerUA commented 11 months ago

Greetings!

I came across your work and was very interested in it. However, while studying the package, I ran into a problem. I am a new one in Laravel so maybe it is easy to deal with it but I don't know how to solve it.

If I work with the first chat that was added to the db table ('telegraph_chats'), everything works fine. But as soon as I start testing the bot from another user, the bot stops and do not responding. If I reset chat table and delete second user from it, it started working fine again. But it starting when telegram started using ->send() function. For example with ->reply() it works fine and both users get messages.

Could you please help with this? It looks like the same what is in #430 issue. Thanks in advance. It shows this error:

[2023-11-29 16:32:41] local.ERROR: No TelegraphChat defined for this request {"exception":"[object] (DefStudio\Telegraph\Exceptions\TelegraphException(code: 0): No TelegraphChat defined for this request at D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Exceptions\TelegraphException.php:16) [stacktrace]

0 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Concerns\HasBotsAndChats.php(116): DefStudio\Telegraph\Exceptions\TelegraphException::missingChat()

1 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Concerns\HasBotsAndChats.php(121): DefStudio\Telegraph\Telegraph->getChat()

2 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Concerns\ComposesMessages.php(28): DefStudio\Telegraph\Telegraph->getChatId()

3 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Concerns\ComposesMessages.php(36): DefStudio\Telegraph\Telegraph->setMessageText('\xD0\x9E\xD0\xB1\xD0\xB5\xD1\x80\xD1\x96\xD1\x82\xD1\x8C ...')

4 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Concerns\ComposesMessages.php(19): DefStudio\Telegraph\Telegraph->html('\xD0\x9E\xD0\xB1\xD0\xB5\xD1\x80\xD1\x96\xD1\x82\xD1\x8C ...')

5 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(353): DefStudio\Telegraph\Telegraph->message('\xD0\x9E\xD0\xB1\xD0\xB5\xD1\x80\xD1\x96\xD1\x82\xD1\x8C ...')

6 D:\OSPanel\domains\GUD_E_Laravel\app\Telegram\Handler.php(21): Illuminate\Support\Facades\Facade::__callStatic('message', Array)

7 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Handlers\WebhookHandler.php(81): App\Telegram\Handler->site('/site')

8 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Handlers\WebhookHandler.php(108): DefStudio\Telegraph\Handlers\WebhookHandler->handleCommand(Object(Illuminate\Support\Stringable))

9 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Handlers\WebhookHandler.php(228): DefStudio\Telegraph\Handlers\WebhookHandler->handleMessage()

10 D:\OSPanel\domains\GUD_E_Laravel\vendor\defstudio\telegraph\src\Controllers\WebhookController.php(28): DefStudio\Telegraph\Handlers\WebhookHandler->handle(Object(Illuminate\Http\Request), Object(DefStudio\Telegraph\Models\TelegraphBot))

11 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(46): DefStudio\Telegraph\Controllers\WebhookController->handle(Object(Illuminate\Http\Request), '6863194088:AAHP...')

12 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Route.php(259): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(DefStudio\Telegraph\Controllers\WebhookController), 'handle')

13 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Route.php(205): Illuminate\Routing\Route->runController()

14 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(799): Illuminate\Routing\Route->run()

15 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

16 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

17 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(798): Illuminate\Pipeline\Pipeline->then(Object(Closure))

18 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(777): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

19 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(741): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

20 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(730): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

21 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(200): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

22 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))

23 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

24 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

25 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))

26 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

27 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

28 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))

29 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

30 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

31 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

32 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))

33 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Http\Middleware\HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

34 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))

35 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Http\Middleware\TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

36 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

37 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

38 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(175): Illuminate\Pipeline\Pipeline->then(Object(Closure))

39 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

40 D:\OSPanel\domains\GUD_E_Laravel\public\index.php(51): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

41 D:\OSPanel\domains\GUD_E_Laravel\vendor\laravel\framework\src\Illuminate\Foundation\resources\server.php(16): require_once('D:\\OSPanel\\doma...')

42 {main}

"}

Nurbolaaaat commented 11 months ago

use $this->chat->message almost Telegraph:message

SawyerUA commented 11 months ago

use $this->chat->message almost Telegraph:message

Great thanks. It works.