Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix showing the webhook information in an Artisan command #1044

Merged
merged 1 commit into from
Mar 27, 2023

Conversation

pavel-mironchik
Copy link
Contributor

Getting a WebHook info using the artisan command php artisan telegram:webhook bot_name --info throws an exception now:

A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given. 

That's because of the WebhookInfo containing the allowed_updates field of the type array of string. Here is a link to the documentation: https://core.telegram.org/bots/api#webhookinfo.

The proposed change converts the received array to a string, so it could be easily represented in a console window:

************************
*     Webhook Info     *
************************

+------------------------+----------------------+
| Bot: bot_name                                 |
+------------------------+----------------------+
| Key                    | Info                 |
+------------------------+----------------------+
| Url                    |                      |
| Has Custom Certificate | No                   |
| Pending Update Count   | 0                    |
| Allowed Updates        | message              |
|                        | edited_message       |
|                        | channel_post         |
|                        | edited_channel_post  |
|                        | inline_query         |
|                        | chosen_inline_result |
|                        | callback_query       |
|                        | shipping_query       |
|                        | pre_checkout_query   |
|                        | poll                 |
|                        | poll_answer          |
|                        | my_chat_member       |
|                        | chat_member          |
|                        | chat_join_request    |
+------------------------+----------------------+

@irazasyed irazasyed merged commit dd578f5 into irazasyed:3.x Mar 27, 2023
@irazasyed
Copy link
Owner

Thanks!

@pavel-mironchik pavel-mironchik deleted the fix-artisan-command branch March 27, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants