def get_members(peer_id: int) -> list:
return vk.method("messages.getConversationMembers", {
"peer_id": peer_id
})["items"]
def get_admins(peer_id: int) -> list:
return [
i["member_id"] for i in get_members(peer_id)
if i.get("is_admin", False)
]
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.text.lower() == "any_command":
if event.obj.from_id in get_admins(event.obj.peer_id):
do_something()