Javascript 获取电报组的所有用户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51050063/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 04:44:49  来源:igfitidea点击:

Get all users of telegram group

javascriptnode.jsbotstelegram

提问by juanjo Rodriguez

I'm trying to obtain all users of a telegram group, I see the method getChatAdministrators, but I think the API doesn't have a method for obtaining all members.

我正在尝试获取电报组的所有用户,我看到了 getChatAdministrators 方法,但我认为 API 没有获取所有成员的方法。

I'm using telegram-bot-api of nodejs

我正在使用 nodejs 的电报机器人 API

回答by Distjubo

Telegram Bot API:

电报机器人 API

What you are trying to archive is currently not possible using the bot api. I'm not sure about the nodejs api, but the official bot api (which your implementation is likely to use) currently doesn't allow getting specific information about all members.

您尝试存档的内容目前无法使用 bot api。我不确定 nodejs api,但是官方的 bot api(您的实现可能会使用它)目前不允许获取有关所有成员的特定信息。

What you can do though, is query how many users are currently in a group, using getchatmemberscount. And if you have the user id of one of the groups members, you can get further information about that user with the getchatmember function.

但是,您可以做的是使用getchatmemberscount查询当前组中有多少用户。如果您拥有组成员之一的用户 ID,则可以使用getchatmember 函数获取有关该用户的更多信息。

Telegram API:

电报API

With the Telegram API, you can control a "regular" user about how you would control a bot. It won't be apparent to any other users that your account is automated if you decide to use this API; in fact, the official telegram apps use it as their backend. However, you will need to sign up with your phone number just like you would with a regular account.

使用 Telegram API,您可以控制“普通”用户如何控制机器人。如果您决定使用此 API,则任何其他用户都不会发现您的帐户是自动化的;事实上,官方电报应用程序将其用作后端。但是,您需要像使用普通帐户一样使用您的电话号码进行注册。

With this API, you can query all the chats the bot is in very easily using the getChats function. Then, you can query full chat info for a specific chat (including all users and their details) using getFullChat.

使用此 API,您可以使用getChats 函数轻松查询机器人所在的所有聊天记录。然后,您可以使用getFullChat查询特定聊天的完整聊天信息(包括所有用户及其详细信息)。

回答by Hyman'lul

Telegram Bot API does not provide such functionality, the only way to do this efficiently is by using userbot (bot running under regular Telegram account).

Telegram Bot API 不提供此类功能,有效执行此操作的唯一方法是使用 userbot(在常规 Telegram 帐户下运行的机器人)。

回答by EvanLee

Have you solved the problem? I use the GetChatMemberCount method of the telegram bot api to get the membercount of the group. And I can also use the bot api to get the user information who send message to the group.I doubt that is there any other way to get the membercount without the bot api.

你解决问题了吗?我使用电报机器人 api 的 GetChatMemberCount 方法来获取组的成员数。而且我还可以使用bot api来获取向组发送消息的用户信息。我怀疑有没有其他方法可以在没有bot api的情况下获取成员数。

回答by Smitk

You can extract all the members of any given group or channel(you need to be an admin for channel) using telethon, you can use telethon for that, you can find it here :- https://github.com/LonamiWebs/Telethon

您可以使用 Telethon 提取任何给定组或频道的所有成员(您需要成为频道管理员),您可以使用 Telethon,您可以在此处找到它:- https://github.com/LonamiWebs/Telethon

Telethon extracts all the members of an given group and saves it in a SQLite database.

Telethon 提取给定组的所有成员并将其保存在 SQLite 数据库中。