Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent User ID for Anonymous Admin #667

Open
Nusab19 opened this issue Nov 29, 2024 · 2 comments
Open

Inconsistent User ID for Anonymous Admin #667

Nusab19 opened this issue Nov 29, 2024 · 2 comments

Comments

@Nusab19
Copy link

Nusab19 commented Nov 29, 2024

I want to implement a "Admin only" feature in a group.

Here's the scenario. "X" is an Anonymous Group Admin.

  1. X sends a command /settings [ Bot gets 1087968824 as the user.id ]
  2. Bot replies with a message containing an Inline Keyboard
  3. X presses a key. [ Bot gets the user's real user.id eg. 5596148289 and not 1087968824 ]
  4. Bot tries to get the group administrators. But the real user's id is not there.

Now, there is no way for the bot to determine if the user who pressed the button is a group admin or not.

If when pressed the button, it returned 1087968824 as the user.id, it wouldn't have been a problem.

Is there any other workaround for this?

Note: 1087968824 is the userID of Group Anonymous Bot

@Sarisan
Copy link

Sarisan commented Nov 29, 2024

I don't think Telegram servers themselves support it. I would rather ignore any incoming requests from 1087968824 and 777000 to avoid user data leak or undefined behavior.

@Nusab19
Copy link
Author

Nusab19 commented Nov 29, 2024

@Sarisan The problem is, because of the "Anonymous Admin" feature, I can't add an admin command in a group.
Because I have no way of knowing if the user is an admin or not.

Maybe providing a is_group_admin property with the Update would be lot better than the classical approach.

Example:

{
 "update_id": 936805440,
 "message": {
  "message_id": 1340,
  "from": {
   "id": 123123123,
   "is_bot": false,
   "first_name": "Someone",
   "username": "notMe",
   "is_group_admin": true
  },
  "sender_chat": {
   "id": -1002068831209,
   "title": "Bot Test Group",
   "is_forum": true,
   "type": "supergroup"
  },
  "chat": {
   "id": -1002068831209,
   "title": "Bot Test Group",
   "is_forum": true,
   "type": "supergroup"
  },
  "date": 1732920638,
  "text": "hello",
  "entities": []
 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants