Added Python 3.8 compatible async_pymongo version
This commit is contained in:
parent
e9ef008080
commit
8a3012b9be
@ -34,16 +34,16 @@ class PyroGroup:
|
||||
"id": id,
|
||||
}
|
||||
)
|
||||
|
||||
if db_entry is None:
|
||||
inserted = await col_groups.insert_one(
|
||||
{"id": id, "locale": locale, "locale_auto": locale_auto}
|
||||
)
|
||||
db_entry = {
|
||||
"_id": inserted.inserted_id,
|
||||
"id": id,
|
||||
"locale": locale,
|
||||
"locale_auto": locale_auto,
|
||||
}
|
||||
db_entry = await col_groups.find_one({"_id": inserted.inserted_id})
|
||||
|
||||
if db_entry is None:
|
||||
raise RuntimeError("Could not find inserted group entry.")
|
||||
|
||||
return cls(**db_entry)
|
||||
|
||||
async def set_locale(self, locale: Union[str, None]) -> None:
|
||||
@ -63,7 +63,7 @@ class PyroGroup:
|
||||
# Group settings
|
||||
# User locale
|
||||
def select_locale(
|
||||
self, app: PyroClient, user: Union[User, None] = None, ignore_auto: bool = False
|
||||
self, app: PyroClient, user: User, ignore_auto: bool = False
|
||||
) -> str:
|
||||
if not ignore_auto and self.locale_auto is True:
|
||||
if user.language_code is not None:
|
||||
|
@ -45,6 +45,7 @@ class PyroUser:
|
||||
mistakes: int = 0,
|
||||
):
|
||||
db_entry = await col_users.find_one({"id": id, "group": group})
|
||||
|
||||
if db_entry is None:
|
||||
inserted = await col_users.insert_one(
|
||||
{
|
||||
@ -57,16 +58,11 @@ class PyroUser:
|
||||
"mistakes": mistakes,
|
||||
}
|
||||
)
|
||||
db_entry = {
|
||||
"_id": inserted.inserted_id,
|
||||
"id": id,
|
||||
"group": group,
|
||||
"failed": failed,
|
||||
"emojis": emojis,
|
||||
"selected": selected,
|
||||
"score": 0,
|
||||
"mistakes": mistakes,
|
||||
}
|
||||
db_entry = await col_users.find_one({"_id": inserted.inserted_id})
|
||||
|
||||
if db_entry is None:
|
||||
raise RuntimeError("Could not find inserted user entry.")
|
||||
|
||||
return cls(**db_entry)
|
||||
|
||||
async def set_failed(self, failed: bool = True) -> None:
|
||||
|
@ -1,13 +1,9 @@
|
||||
aiofiles~=23.2.1
|
||||
apscheduler~=3.10.1
|
||||
async_pymongo==0.1.3
|
||||
black~=23.7.0
|
||||
Pillow~=10.0.0
|
||||
pykeyboard==0.1.5
|
||||
pyrogram==2.0.106
|
||||
tgcrypto==1.2.5
|
||||
ujson==5.8.0
|
||||
uvloop==0.17.0
|
||||
--extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple
|
||||
async_pymongo==0.1.4
|
||||
huepaper==0.0.4
|
||||
libbot[speed,pyrogram]==2.0.1
|
Reference in New Issue
Block a user