mirror of
https://github.com/dizedev/vk_lp.git
synced 2026-09-17 07:28:50 +00:00
22 lines
598 B
Python
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
|