This commit closes #11

This commit is contained in:
Profitroll 2023-08-14 11:56:59 +02:00
parent 8a3012b9be
commit 7a587ececa
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
2 changed files with 37 additions and 6 deletions

View File

@ -3,6 +3,7 @@ from dataclasses import dataclass
from typing import Union
from bson import ObjectId
from libbot import sync
from pyrogram.types import User
from classes.pyroclient import PyroClient
@ -26,8 +27,8 @@ class PyroGroup:
async def create_if_not_exists(
cls,
id: int,
locale: Union[str, None] = None,
locale_auto: bool = True,
locale: Union[str, None] = sync.config_get("locale", "defaults", "group"),
locale_auto: bool = sync.config_get("locale_auto", "defaults", "group"),
):
db_entry = await col_groups.find_one(
{
@ -37,7 +38,11 @@ class PyroGroup:
if db_entry is None:
inserted = await col_groups.insert_one(
{"id": id, "locale": locale, "locale_auto": locale_auto}
{
"id": id,
"locale": locale,
"locale_auto": locale_auto,
}
)
db_entry = await col_groups.find_one({"_id": inserted.inserted_id})

View File

@ -19,9 +19,14 @@
"port": 27017,
"name": "captchabot"
},
"timeouts": {
"join": 2,
"verify": 3
"defaults": {
"group": {
"locale": null,
"locale_auto": true,
"ban_failed": true,
"timeout_join": 180,
"timeout_verify": 300
}
},
"whitelist": {
"enabled": false,
@ -113,6 +118,13 @@
}
]
},
"ban_failed": {
"scopes": [
{
"name": "BotCommandScopeAllChatAdministrators"
}
]
},
"language": {
"scopes": [
{
@ -126,6 +138,20 @@
"name": "BotCommandScopeAllChatAdministrators"
}
]
},
"timeout_join": {
"scopes": [
{
"name": "BotCommandScopeAllChatAdministrators"
}
]
},
"timeout_verify": {
"scopes": [
{
"name": "BotCommandScopeAllChatAdministrators"
}
]
}
}
}