File tree Expand file tree Collapse file tree 3 files changed +25
-26
lines changed Expand file tree Collapse file tree 3 files changed +25
-26
lines changed Original file line number Diff line number Diff line change 8
8
9
9
Route::post ('/{token}/{bot} ' , config ('telegram.webhook.controller ' ))->name ('telegram.bot.webhook ' );
10
10
11
- // # Longpolling method (manual).
12
- // Route::get('/{token}/updates/{bot?}', function ($bot = 'default') {
13
- // # This method will fetch updates,
14
- // # fire relevant events and,
15
- // # confirm we've received the updates with Telegram.
16
- //
17
- // $updates = Telegram::bot($bot)->listen();
18
- //
19
- // # You can do something with the fetched array of update objects.
20
- //
21
- // # NOTE: You won't be able to fetch updates if a webhook is set.
22
- // # Remove webhook before using this method.
23
- // })->name('telegram.bot.updates');
11
+ // # Longpolling method (manual).
12
+ // Route::get('/{token}/updates/{bot?}', function ($bot = 'default') {
13
+ // # This method will fetch updates,
14
+ // # fire relevant events and,
15
+ // # confirm we've received the updates with Telegram.
16
+ //
17
+ // $updates = Telegram::bot($bot)->listen();
18
+ //
19
+ // # You can do something with the fetched array of update objects.
20
+ //
21
+ // # NOTE: You won't be able to fetch updates if a webhook is set.
22
+ // # Remove webhook before using this method.
23
+ // })->name('telegram.bot.updates');
24
24
});
Original file line number Diff line number Diff line change 3
3
namespace Telegram \Bot \Laravel \Events ;
4
4
5
5
use Telegram \Bot \Objects \ResponseObject ;
6
- use Telegram \Bot \Objects \Update ;
7
6
use Throwable ;
8
7
9
8
/**
Original file line number Diff line number Diff line change @@ -26,20 +26,20 @@ class WebhookController extends Controller
26
26
public function __invoke (BotManager $ manager , string $ token , string $ bot )
27
27
{
28
28
App::terminating (static function () use ($ manager , $ bot ): void {
29
- try {
30
- $ manager ->bot ($ bot )->listen (true );
31
- } catch (Throwable $ e ) {
32
- $ telegram = $ manager ->bot ($ bot );
29
+ try {
30
+ $ manager ->bot ($ bot )->listen (true );
31
+ } catch (Throwable $ e ) {
32
+ $ telegram = $ manager ->bot ($ bot );
33
33
34
- $ telegram ->getEventFactory ()->dispatch (
35
- WebhookFailed::NAME ,
36
- new WebhookFailed ($ bot , $ telegram ->getWebhookUpdate (), $ e )
37
- );
34
+ $ telegram ->getEventFactory ()->dispatch (
35
+ WebhookFailed::NAME ,
36
+ new WebhookFailed ($ bot , $ telegram ->getWebhookUpdate (), $ e )
37
+ );
38
38
39
- if (! $ telegram ->getEventFactory ()->hasListeners (WebhookFailed::NAME )) {
40
- throw WebhookException::failedToListenToUpdate ($ e ->getMessage (), $ e );
41
- }
42
- }
39
+ if (! $ telegram ->getEventFactory ()->hasListeners (WebhookFailed::NAME )) {
40
+ throw WebhookException::failedToListenToUpdate ($ e ->getMessage (), $ e );
41
+ }
42
+ }
43
43
});
44
44
45
45
return response ()->noContent ();
You can’t perform that action at this time.
0 commit comments