some edits

This commit is contained in:
2023-10-30 00:46:41 +07:00
parent d5341e8fb5
commit e35a687991
7 changed files with 279 additions and 14 deletions
+10 -12
View File
@@ -3,21 +3,19 @@ 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 = self.load_trusted_ids()
def load_trusted_ids(self):
try:
with open("./user_ids.json", "r") as json_file:
data = json.load(json_file)
return data
except FileNotFoundError:
# Если файл не существует, вернуть пустой список
return []
self.trusted_ids = load_trusted_ids()
async def check(self, event: Message) -> bool:
return event.from_id in self.trusted_ids