Reputation: 981
I have added my bot to a group chat, now for few commands I need to give access only to the group admin, so is it possible to identify if the message sender is admin of the group? I am using python-telegram-bot library
Upvotes: 3
Views: 8295
Reputation: 8005
When you use getUpdates, you can see .message.chat.type
is group
or not.
And then use getChatMember, .result.status
should be administrator
or creator
.
Upvotes: 7
Reputation: 178
It is absolutely possible. You can use the getChatAdministrators
API method (returns a list of ChatMember
) to get a list of admins for a chat, or the getChatMember
API method (returns a single ChatMember
) to get the admin status of a single user.
An efficient method to solve this problem is described here: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets#cached-telegram-group-administrator-check
Upvotes: 3
Reputation: 141
No. You need to hardcode user id in your source and compare if user id in admin-ids array.
Upvotes: -1