From be6e7ecb9c8f6c3678d06a9c9d91e82d33ed4546 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 25 Oct 2021 15:20:41 +0700 Subject: [PATCH] change --- driver/admins.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 driver/admins.py diff --git a/driver/admins.py b/driver/admins.py new file mode 100644 index 0000000..808f2ab --- /dev/null +++ b/driver/admins.py @@ -0,0 +1,19 @@ +from typing import List +from pyrogram.types import Chat +from cache.admins import get as gett, set + +async def get_administrators(chat: Chat) -> List[int]: + get = gett(chat.id) + + if get: + return get + else: + administrators = await chat.get_members(filter="administrators") + to_set = [] + + for administrator in administrators: + if administrator.can_manage_voice_chats: + to_set.append(administrator.user.id) + + set(chat.id, to_set) + return await get_administrators(chat)