Closed PeterHunt closed 1 year ago
Hello Karl-Heinz,
Sorry to bother you, but did you manage to check/reproduce this issue maybe?
Maybe after vacation sry
No problem. Be sure to enjoy your holiday :) I was just wondering because you did not reply. Take your time and please allow me to buy you a beer in stead of a coffee :)
Hehe... thanks alot!
So what are you using "editMessageText" or "editMessageCaption" or "editMessageReplyMarkup" or "editMessageMedia"?
msg.payload.type = 'editMessageText';
In case of "editMessageText" you can have a look here: https://core.telegram.org/bots/api#editmessagetext
Only text is a required property, but as you can read in the documentation you can pass chat_id, message_id, ... as optional parameters.
The explanation of chat_id says: "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"
I know that this is weird, but the underlying lib implemented it like this:
/**
I know, I just wanted to point out that behaviour is not as expected. But, it's working for me. So actually, I have no issue (no more). I was just wondering if this is as it should be?
In one situation I use
msg.payload.chatId = 123456789;
In the other
msg.payload.options.chat_id = 123456789;
No problem for me, though. It was more a heads up than an issue.
msg.payload.content is the first parameter and msg.payload.options is the second one for the lib.
msg.payload.chatId however is used by the node itself for all kind of functions like sendMessage, forwardMessage, copyMessage,... as far as I can see this is not used in editMessageText.
I know this is a little bit inconsistent, but don't ask me why it was implemented like that. So in you case you do not really need msg.payload.chatId when calling editMessageText
The same goes for editMessageCaption, editMessageReplyMarkup, editMessageMedia stopMessageLiveLocation, editMessageLiveLocation
Maybe I should extend the table in the readme by adding an additional column that indicates whether msg.payload.chatId is required or not
Oke, clear now. I thought this 'oddity' was in your telegrambot. But in fact it's due to the lib. Maybe an addition to the table makes it more clear. It took me some time to figure out, but eventually I managed :)
I will adapt the code in a way that the code will work as you expected it. msg.payload.chatId will be copied to the options.chat_id
You are not the first one who had troubles with that pitfall
Hi Karl,
I recently started using threaded groups with your Telegram BOT.
When I send a message to a thread, I can use :
When I want to edit a message, the chatId property does not seem to be valid.
For now, I've managed to edit the message via:
To be honest, I'm not sure whether both chatIds are necessary, but as I said, this seems to be working.
Can you please test this? I'm not sure if this is as expected? I would expect, like posting a message, editing would be like:
Kind regards,
Peter Hunt.