Telegram 机器人能否检测到新成员加入频道活动?

Can Telegram bot detect a new member joining a channel event?

我有一个 Telegram 机器人,我将这个机器人设置为一个频道的管理员。现在,当一个新用户通常加入一个频道(而不是一个组)时,频道上没有消息,我们无法通过 getUpdates 方法获得任何消息。 post 一条消息说“一个新用户已加入频道”在技术上是否可行 - 这会捕获“新成员”事件?让我知道。

不幸的是,您现在无法检查用户是否通过 Telegram bot API 加入了频道。也许将来你可以。

但您可以在此处为群组或超级群组执行此操作:

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

这些也很有用:

Telegram Bot Event When Users Join To Channel

How to get channel updates with Telegram robot

更新:

But a TG bot api with admin rights can see all its members. So even if the api doesn’t support it, it can track a count and see if it increases and then know that a new member joined. Correct? I don’t need to know exactly WHICH new member joined but just know a new one joined to share a welcome message

是的,您可以使用 getChatMembersCount。这是来自 link 的信息:

getChatMembersCount: Use this method to get the number of members in a chat. Returns Int on success.

也可以使用getChatMemberhere是一些信息:

getChatMember: Use this method to get information about a member of a chat. Returns a ChatMember object on success.

如果您正在使用 python-telegram-bot library, there is a method called new_chat_members in this doc

它将 return 聊天的所有新成员。