Prepare for feature disable welcome

This commit is contained in:
Yasir Aris M 2024-06-30 21:37:21 +07:00 committed by GitHub
parent 79745cb2d6
commit 395472a319
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

19
database/greetings_db.py Normal file
View file

@ -0,0 +1,19 @@
from database import dbname
greetingdb = dbname["greetings"]
async def is_welcome(chat_id: int) -> bool:
greets = await greetingdb.find_one({"chat_id": chat_id})
return bool(greets)
async def welcome_off(chat_id: int):
wlc = await greetingdb.find_one({"chat_id": chat_id})
if wlc:
return await cleandb.delete_one({"chat_id": chat_id})
async def welcome_on(chat_id: int):
wlc = await greetingdb.find_one({"chat_id": chat_id})
if not wlc:
return await greetingdb.insert_one({"chat_id": chat_id})
# todo other features for custom welcome here