This commit is contained in:
yasir 2022-12-08 11:05:42 +07:00
parent c57a12dfa0
commit b9c5a5ff31
2 changed files with 5 additions and 7 deletions

View file

@ -1,4 +1,5 @@
from database import dbname
from typing import Dict, Union
filtersdb = dbname.filters

View file

@ -31,10 +31,9 @@ async def add_warn(chat_id: int, name: str, warn: dict):
warns = await get_warns(chat_id)
warns[name] = warn
await warnsdb.update_one({"chat_id": chat_id}, {"$set": {
"warns": warns
}},
upsert=True)
await warnsdb.update_one(
{"chat_id": chat_id}, {"$set": {"warns": warns}}, upsert=True
)
async def remove_warns(chat_id: int, name: str) -> bool:
@ -44,9 +43,7 @@ async def remove_warns(chat_id: int, name: str) -> bool:
del warnsd[name]
await warnsdb.update_one(
{"chat_id": chat_id},
{"$set": {
"warns": warnsd
}},
{"$set": {"warns": warnsd}},
upsert=True,
)
return True