windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
264 stars 117 forks source link

How to editForumTopic #305

Closed PeterHunt closed 1 year ago

PeterHunt commented 1 year ago

Hello,

I managed to get the Forum Topics working and this is a great additition to one of my groups. Now I'm wondering how to edit a Forum Topic? As for the manual the msg.payload.content needs to be an object as ;

{ chat_id (integer/string), message_thread_id (integer), name (string) }

But I can't manage to edit the topic, I don't see any errors in the console and when I attach a debug to the output of the sender node it also remains very quiet.

Can someone point me to an example maybe?

Kind regards, Peter Hunt.

PeterHunt commented 1 year ago

Somehow it seems as if the message_thread_id is ignored. Whatever I try, I keep getting Error: ETELEGRAM: 400 Bad Request: invalid message thread identifier specified

And the options object shows "options":{"message_thread_id":" ","chat_id":-1234567890}

I do send a valid message_thread_id which works for bot posting and editing messages. Can you please try and test this?

PeterHunt commented 1 year ago

Oh and another thing I just noticed. Is it possible for the BOT to fetch opening/closing of a topic? Through the receiver node and my_chat_member I don't see any data when I open or close a topic. Not sure if this data is fetchable at all? :)

windkh commented 1 year ago

Oh and another thing I just noticed. Is it possible for the BOT to fetch opening/closing of a topic? Through the receiver node and my_chat_member I don't see any data when I open or close a topic. Not sure if this data is fetchable at all? :)

Hm right now I don't think that this is possible, maybe in future.

windkh commented 1 year ago

https://core.telegram.org/bots/api#editforumtopic

note that only "Optional" parameters need to be passed in msg.payload.options. The parameters marked with "yes" in column Required need to be passed in msg.payload.content

Please try msg.payload.content = 1234 // your message_thread_id

PeterHunt commented 1 year ago

I'm sorry, I'm not really familiar with GitHub, I expected to be able to re-open this issue, but I am not. I removed my last comment as I wanted to re-open this issue, but anyways, not to get your attention, this was my last comment regarding to this issue;


Thanks for the feedback. I managed to get payload via the output of the sender node, which is :

payload: object
chatId: -1001871187318
type: "editForumTopic"
content: true
name: "TEST"
options: object
chat_id: -1001871187318
message_thread_id: 18
sentMessageId: undefined
_msgid: "58b6303661b7d638"

But nothing happens regarding to the forum topic. The BOT is admin and has full rights. Does this output look OK? The current input is now ;

msg = {};
msg.payload = {};
msg.payload.chatId = -1001871187318
msg.payload.type = "editForumTopic";
msg.payload.content = 18;
msg.payload.name = "TEST";

return msg;