如何通过我的电报机器人在聊天中标记每个人?

发布于 2025-02-04 15:37:46 字数 97 浏览 3 评论 0原文

我需要在聊天中添加机器人的聊天中标记每个人。 我的机器人写道: @all,它应该在聊天中标记每个人。 我看不到任何电报API方法可以在特定的聊天中吸引所有用户。我应该如何解决问题?

I need to tag everybody in chat where my bot added.
My bot writes: @all and it should tag everybody in the chat.
I don't see any Telegram API methods to get all users in specific chat. How should I resolve the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嗫嚅 2025-02-11 15:37:46

一条消息中有各种障碍不会让您提及每个人:

  • 您只能在每条消息中提及多达50个。 noreferrer”> [1]
  • 您无法使用bot中的所有成员列表。

如果您坚持这样做,则应使用数据库来收集有关成员的信息在这些聊天中,当他们发送消息时。之后,您应该发送多个消息以提及所有50 x 50乘50。

如果您想要一种通知所有成员的简单方法,则只需固定消息即可。

There are various obstacles that don't let you mention everyone in a single message:

  • You can only have up to 50 mentions in each message.[1]
  • You cannot fetch a list of all members in a chat using a bot.

If you insist on doing this, you should use a database to collect information about the members of these chats, when they send messages. And afterward, you should send multiple messages to mention all of them 50 by 50.

If you want a simple way to notify all members, you can just pin a message.

薄荷港 2025-02-11 15:37:46

实际上,可以解析所有聊天成员。

您可以在Telethon库中使用client.iter_iter_participant(CHAT)

Actually, it is possible to parse all the chat members.

You can use client.iter_participants(chat) in telethon library for this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文