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

View File

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