MissKatyPyro/database/greetings_db.py
deepsource-autofix[bot] 2aa93bb4d5
style: format code with isort, Ruff Formatter and Yapf (#300)
* style: format code with isort, Ruff Formatter and Yapf

This commit fixes the style issues introduced in f9f107e according to the output
from isort, Ruff Formatter and Yapf.

Details: None

* refactor: autofix issues in 2 files

Resolved issues in the following files with DeepSource Autofix:
1. misskaty/plugins/download_upload.py
2. misskaty/plugins/nightmodev2.py

* style: format code with isort, Ruff Formatter and Yapf

This commit fixes the style issues introduced in 1bc1345 according to the output
from isort, Ruff Formatter and Yapf.

Details: https://github.com/yasirarism/MissKatyPyro/pull/300

* refactor: autofix issues in 2 files

Resolved issues in the following files with DeepSource Autofix:
1. misskaty/plugins/dev.py
2. misskaty/plugins/misc_tools.py

* style: format code with isort, Ruff Formatter and Yapf

This commit fixes the style issues introduced in 58d2f1a according to the output
from isort, Ruff Formatter and Yapf.

Details: https://github.com/yasirarism/MissKatyPyro/pull/300

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Yasir Aris M <git@yasirdev.my.id>
2024-07-30 11:52:58 +07:00

19 lines
464 B
Python

from database import dbname
greetingdb = dbname["greetings"]
async def is_welcome(chat_id: int) -> bool:
return bool(await greetingdb.find_one({"chat_id": chat_id}))
async def toggle_welcome(chat_id: int):
if await is_welcome(chat_id):
await greetingdb.delete_one({"chat_id": chat_id})
return False
else:
await greetingdb.insert_one({"chat_id": chat_id})
return True
# todo other features for custom welcome here