I am using the telegram bot api to make a bot. I have some commands that can only be sent from admins. Like kick and ban commands. How do I check if the sender is an admin or not? I am using the python-telegram-bot
api. I do not want everyone to be able to ban members.
The admin status is stored under Telegram. ChatMember. status . It is documented here.
For get a list of administrators (except other bots) in a channel, you can use the getChatAdministrators method. Remember that the bot must be admin of the channel. In no way you can get the administrators of a channel without be an administrator.
Telegram chats can have an unlimited number of administrators. To add an admin, you don't have to quit being an admin yourself. However, if you don't want to be a group admin any longer, you can assign the administrator privileges to someone else.
You can use getChatMember
method. See following instance:
I have found after searching a bit. The admin status is stored under Telegram.ChatMember.status
. It is documented here. It is used by bot.get_chat_member(chat_id, user_id)
. And then getting status in it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With