windkh / node-red-contrib-telegrambot

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

Channels #273

Closed PeterHunt closed 1 year ago

PeterHunt commented 2 years ago

Hello,

I notice that the msg.originalMessage.from.{object} is not available for channels. Does Telegram API not offer this data, or is it telegrambot related?

Also, is it or would it be possile to fetch join actions in channels? For example, it my BOT joins a channel, I would like to fetch this action so I can connect an action to it.

Kind regards, Peter Hunt.

windkh commented 2 years ago

Hi @PeterHunt Channels are limited in many ways. There were many discussions about that in here. Just have a look at the closed issues.

About your second question... the bot can handle several events but I never heard about a joined-channel-event. Let me investigate that maybe I can find a solution for you. Br kh

windkh commented 1 year ago

@PeterHunt you can use the event node to capture that event:

image

PeterHunt commented 1 year ago

Thanks! I will look into it :)

PeterHunt commented 1 year ago

Oke I checked it but have another question. When I add or remove my BOT for a channel I see that both old_chat_member and new_chat_member are defined. This is a bit confusing. Should they both be defined? I would expect to see only new_chat_member if added and only old_chat_member when kicked.

For example, when I add my BOT I also see status: kicked in old_chat_member.

Maybe I am overlooking something, but I am trying to find a unique property to determine whether my BOT is either added or kicked.

windkh commented 1 year ago

I can not change that as data comes directly from the Telegram Server See https://core.telegram.org/bots/api#chatmemberupdated

PeterHunt commented 1 year ago

AH, I think I'm starting to understand now. I thought "new_chat_member" was equal to "added" and "old_chat_member" equal to "kicked".

But as for the link you sent and re-checking the objects, it seems as if new = current info and old = previous info. As for the next update, the new object moves to the old object.

If so, I can just check the new_chat_member which should contain the actual/current data for my BOT, making the old object not interesting for me.

Thanks, this also answers my initial question. I can see my own user details in the "from" object, offering me the ability to limit the number of channels in which my BOT is added per user :)