mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
- AutoFix Code Using DeepSource - Fix os not defined when got error - Fix Set Chat Photo (Only support photo) - Fix Admins Permission Error - Fix KeyError in Scraper - Fix Help Module in Eval - Fix Media Caption Too Long in IMDB - Remove heroku support - Some minor fix..
22 lines
584 B
Python
22 lines
584 B
Python
from typing import Iterable
|
|
|
|
from pyrogram.enums import ChatType
|
|
|
|
from database import dbname
|
|
|
|
localesdb = dbname.locale # DB for localization
|
|
|
|
group_types: Iterable[ChatType] = (ChatType.GROUP, ChatType.SUPERGROUP)
|
|
|
|
|
|
async def set_db_lang(chat_id: int, chat_type: str, lang_code: str):
|
|
await localesdb.update_one(
|
|
{"chat_id": chat_id},
|
|
{"$set": {"lang": lang_code, "chat_type": chat_type.value}},
|
|
upsert=True,
|
|
)
|
|
|
|
|
|
async def get_db_lang(chat_id: int) -> str:
|
|
ul = await localesdb.find_one({"chat_id": chat_id})
|
|
return ul["lang"] if ul else {}
|