mirror of
https://github.com/dizedev/vk_lp.git
synced 2026-09-17 03:58:56 +00:00
Squashed commit of the following:
commit49f8a7c8cbAuthor: /dize <87265715+dizedev@users.noreply.github.com> Date: Mon Oct 30 19:03:08 2023 +0600 Update config.py commite509aa34fdAuthor: Alex <me@chydo.dev> Date: Mon Oct 30 00:53:25 2023 +0700 added requirements commit19eae811abAuthor: Alex <me@chydo.dev> Date: Mon Oct 30 00:50:56 2023 +0700 some fixes// commite35a687991Author: Alex <me@chydo.dev> Date: Mon Oct 30 00:46:41 2023 +0700 some edits
This commit is contained in:
+10
-12
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user