The problem with getting admin?

Need to check if the user is an administrator of chat.
I have this here code:
if event.type == VkBotEventType.MESSAGE_NEW:
 members = vk.messages.getConversationMembers(peer_id=event.object.peer_id)
 for i in members["items"]:
 if i["member_id"] == event.obj.member_id:
 admin = i.get('is_admin', False)

Now need to check admin == True or not, if you just write if admin == True, I get UnboundLocalError: local variable 'admin' referenced before assignment
March 25th 20 at 13:41
0 answer

Find more questions by tags Python