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,
|
"id": id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
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 = {
|
db_entry = await col_groups.find_one({"_id": inserted.inserted_id})
|
||||||
"_id": inserted.inserted_id,
|
|
||||||
"id": id,
|
if db_entry is None:
|
||||||
"locale": locale,
|
raise RuntimeError("Could not find inserted group entry.")
|
||||||
"locale_auto": locale_auto,
|
|
||||||
}
|
|
||||||
return cls(**db_entry)
|
return cls(**db_entry)
|
||||||
|
|
||||||
async def set_locale(self, locale: Union[str, None]) -> None:
|
async def set_locale(self, locale: Union[str, None]) -> None:
|
||||||
@ -63,7 +63,7 @@ class PyroGroup:
|
|||||||
# Group settings
|
# Group settings
|
||||||
# User locale
|
# User locale
|
||||||
def select_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:
|
) -> str:
|
||||||
if not ignore_auto and self.locale_auto is True:
|
if not ignore_auto and self.locale_auto is True:
|
||||||
if user.language_code is not None:
|
if user.language_code is not None:
|
||||||
|
@ -45,6 +45,7 @@ class PyroUser:
|
|||||||
mistakes: int = 0,
|
mistakes: int = 0,
|
||||||
):
|
):
|
||||||
db_entry = await col_users.find_one({"id": id, "group": group})
|
db_entry = await col_users.find_one({"id": id, "group": group})
|
||||||
|
|
||||||
if db_entry is None:
|
if db_entry is None:
|
||||||
inserted = await col_users.insert_one(
|
inserted = await col_users.insert_one(
|
||||||
{
|
{
|
||||||
@ -57,16 +58,11 @@ class PyroUser:
|
|||||||
"mistakes": mistakes,
|
"mistakes": mistakes,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
db_entry = {
|
db_entry = await col_users.find_one({"_id": inserted.inserted_id})
|
||||||
"_id": inserted.inserted_id,
|
|
||||||
"id": id,
|
if db_entry is None:
|
||||||
"group": group,
|
raise RuntimeError("Could not find inserted user entry.")
|
||||||
"failed": failed,
|
|
||||||
"emojis": emojis,
|
|
||||||
"selected": selected,
|
|
||||||
"score": 0,
|
|
||||||
"mistakes": mistakes,
|
|
||||||
}
|
|
||||||
return cls(**db_entry)
|
return cls(**db_entry)
|
||||||
|
|
||||||
async def set_failed(self, failed: bool = True) -> None:
|
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
|
black~=23.7.0
|
||||||
Pillow~=10.0.0
|
Pillow~=10.0.0
|
||||||
pykeyboard==0.1.5
|
pykeyboard==0.1.5
|
||||||
pyrogram==2.0.106
|
|
||||||
tgcrypto==1.2.5
|
tgcrypto==1.2.5
|
||||||
ujson==5.8.0
|
|
||||||
uvloop==0.17.0
|
uvloop==0.17.0
|
||||||
--extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple
|
--extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple
|
||||||
|
async_pymongo==0.1.4
|
||||||
huepaper==0.0.4
|
huepaper==0.0.4
|
||||||
libbot[speed,pyrogram]==2.0.1
|
libbot[speed,pyrogram]==2.0.1
|
Reference in New Issue
Block a user