77use JsonException ;
88use SergiX44 \Nutgram \Nutgram ;
99use SergiX44 \Nutgram \Telegram \Exceptions \TelegramException ;
10+ use function Termwind \{render };
11+
1012
1113class HookInfoCommand extends Command
1214{
@@ -24,7 +26,7 @@ public function handle(Nutgram $bot): int
2426 $ webhookInfo = $ bot ->getWebhookInfo ();
2527
2628 if ($ webhookInfo === null ) {
27- $ this -> error ( ' Unable to get webhook info ' );
29+ render ( view ( ' terminal::fail ' , [ ' value ' => ' Unable to get webhook info ']) );
2830 return 1 ;
2931 }
3032
@@ -38,17 +40,19 @@ public function handle(Nutgram $bot): int
3840 $ lastSynchronizationErrorDate = date ('Y-m-d H:i:s ' , $ webhookInfo ->last_synchronization_error_date ).' UTC ' ;
3941 }
4042
41- $ this ->table (['Info ' , 'Value ' ], [
42- ['url ' , $ webhookInfo ->url ],
43- ['has_custom_certificate ' , $ webhookInfo ->has_custom_certificate ? 'true ' : 'false ' ],
44- ['pending_update_count ' , $ webhookInfo ->pending_update_count ],
45- ['ip_address ' , $ webhookInfo ->ip_address ],
46- ['last_error_date ' , $ lastErrorDate ],
47- ['last_error_message ' , $ webhookInfo ->last_error_message ],
48- ['last_synchronization_error_date ' , $ lastSynchronizationErrorDate ],
49- ['max_connections ' , $ webhookInfo ->max_connections ],
50- ['allowed_updates ' , implode (', ' , $ webhookInfo ->allowed_updates ?: [])],
51- ]);
43+ render (view ('terminal::table ' , [
44+ 'items ' => [
45+ 'url ' => $ webhookInfo ->url ,
46+ 'has_custom_certificate ' => $ webhookInfo ->has_custom_certificate ? 'true ' : 'false ' ,
47+ 'pending_update_count ' => $ webhookInfo ->pending_update_count ,
48+ 'ip_address ' => $ webhookInfo ->ip_address ,
49+ 'last_error_date ' => $ lastErrorDate ,
50+ 'last_error_message ' => $ webhookInfo ->last_error_message ,
51+ 'last_synchronization_error_date ' => $ lastSynchronizationErrorDate ,
52+ 'max_connections ' => $ webhookInfo ->max_connections ,
53+ 'allowed_updates ' => implode (', ' , $ webhookInfo ->allowed_updates ?: []),
54+ ]
55+ ]));
5256
5357 return 0 ;
5458 }
0 commit comments