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

Document Bot and Conversations chat IDs #48

Open
PaulCombal opened this issue May 20, 2024 · 0 comments
Open

Document Bot and Conversations chat IDs #48

PaulCombal opened this issue May 20, 2024 · 0 comments
Assignees
Labels
question Further information is requested

Comments

@PaulCombal
Copy link

I have a doubt about the way chat IDs are handled in Nutgram, for which I could not find an answer.

I created an inline menu, the running method is polling, here is a snippet of a handler's code:

public function handler(Nutgram $bot) {
...
            echo "==========\n";
            echo "BOT CHAT ID: " . $bot->chatId() . "\n";
            echo "CONV CHAT ID: " . $this->getChatId() . "\n";
            echo "==========\n";
[2024-05-20 17:00:38] DEBUG: ⬇️ Nutgram Response
{"response":{"ok":true,"result":[{"update_id":136638649,"callback_query":{"id":"5185141848770776378","from":{"id":5502227XXX,"is_bot":false,"first_name":"XXX","username":"XXX","language_code":"fr"},"message":{"message_id":161,"from":{"id":6905006184,"is_bot":true,"first_name":"Telebiz_dev_shop_bot","username":"TelebizDevShopBot"},"chat":{"id":5502227XXX,"first_name":"XXX","username":"XXXX","type":"private"},"date":1716224428,"edit_date":1716224432,"text":"produit - 1EUR\ndesc","reply_markup":{"inline_keyboard":[[{"text":"Place order","callback_data":"018f921a-4b16-7119-a9e4-b7110a8d1b39"}],[{"text":"Back to category","callback_data":"018f9219-be39-7662-a952-7a5bf0b9edcf"}]]}},"chat_instance":"-8220016788377822890","data":"018f921a-4b16-7119-a9e4-b7110a8d1b39"}}]},"type":"response"}
===============================
==========
BOT CHAT ID: 5502227XXX
CONV CHAT ID: 
==========

What's the difference between the Bot Chat ID and the Conversation Chat ID?

How come the bot holds the chat ID and the InlineMenu holds NULL?

When does an InlineMenu hold a Chat ID?

Will the bot always be reliable with Chat IDs with multiple concurrent users?

According to this documentation: https://nutgram.dev/docs/usage/conversations#starting-a-conversation-from-server-side , I should be able to retrieve the chat ID from $this since InlineMenu extends Conversation

I am a bit inexperienced with the Telegram API, and this is the kind of moment I wish the documentation would be a bit beefier around these details. Instinctively, it would make more sense to me if the conversation held the chat Id with the user. I need to understand why this was not implemented this way.

Let me know if you need any more details

Thank you for your amazing work

@Lukasss93 Lukasss93 self-assigned this Jun 3, 2024
@Lukasss93 Lukasss93 added the question Further information is requested label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants