Files
vk_lp/custom_rules/permission.py
T
chydo 0622024bec Squashed commit of the following:
commit 49f8a7c8cb
Author: /dize <87265715+dizedev@users.noreply.github.com>
Date:   Mon Oct 30 19:03:08 2023 +0600

    Update config.py

commit e509aa34fd
Author: Alex <me@chydo.dev>
Date:   Mon Oct 30 00:53:25 2023 +0700

    added requirements

commit 19eae811ab
Author: Alex <me@chydo.dev>
Date:   Mon Oct 30 00:50:56 2023 +0700

    some fixes//

commit e35a687991
Author: Alex <me@chydo.dev>
Date:   Mon Oct 30 00:46:41 2023 +0700

    some edits
2023-10-30 22:44:32 +07:00

22 lines
598 B
Python

from vkbottle.dispatch.rules import ABCRule
from vkbottle.user import Message
import json
def load_trusted_ids():
try:
with open("./user_ids.json", "r") as json_file:
data = json.load(json_file)
return data
except FileNotFoundError:
# Если файл не существует, вернуть пустой список
return []
class Permission(ABCRule[Message]):
def __init__(self):
self.trusted_ids = load_trusted_ids()
async def check(self, event: Message) -> bool:
return event.from_id in self.trusted_ids