вынес сообщение глобального фильтра в конфиг

This commit is contained in:
Maxim Slipenko 2024-08-20 23:39:03 +03:00
parent ea7e12c5ed
commit 5a76e94c41
No known key found for this signature in database
GPG Key ID: 6DEA9FA7DE98C7D6

View File

@ -49,9 +49,7 @@ class GlobalFilter(BaseMiddleware):
if config.get("filters::global::private_allowed"): if config.get("filters::global::private_allowed"):
return await handler(event, data) return await handler(event, data)
await event.answer("НЕЛЬЗЯ!") return await event.answer(config.get("filters::global::forbidden_message"))
return
def module_init(): def module_init():
@ -59,7 +57,11 @@ def module_init():
"filters::approved_chat_id", "int", multiple=True, shared=True, default_value=[] "filters::approved_chat_id", "int", multiple=True, shared=True, default_value=[]
) )
config.register("filters::default_chat_tag", "string", shared=True) config.register("filters::default_chat_tag", "string", shared=True)
config.register(
"filters::global::forbidden_message",
"string",
default_value="Вы не имеете доступа!",
)
config.register("filters::global::enabled", "boolean", default_value=False) config.register("filters::global::enabled", "boolean", default_value=False)
config.register("filters::global::private_allowed", "boolean", default_value=False) config.register("filters::global::private_allowed", "boolean", default_value=False)