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
This commit is contained in:
2023-10-30 22:44:32 +07:00
parent 3465160c3a
commit 0622024bec
12 changed files with 273 additions and 50 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