mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-07 12:24:51 +00:00
Penyederhanaan by gpt 4
This commit is contained in:
parent
395472a319
commit
36ddaa6d2b
1 changed files with 6 additions and 11 deletions
|
|
@ -3,17 +3,12 @@ from database import dbname
|
||||||
greetingdb = dbname["greetings"]
|
greetingdb = dbname["greetings"]
|
||||||
|
|
||||||
async def is_welcome(chat_id: int) -> bool:
|
async def is_welcome(chat_id: int) -> bool:
|
||||||
greets = await greetingdb.find_one({"chat_id": chat_id})
|
return bool(await greetingdb.find_one({"chat_id": chat_id}))
|
||||||
return bool(greets)
|
|
||||||
|
|
||||||
async def welcome_off(chat_id: int):
|
async def toggle_welcome(chat_id: int):
|
||||||
wlc = await greetingdb.find_one({"chat_id": chat_id})
|
if await is_welcome(chat_id):
|
||||||
if wlc:
|
await greetingdb.delete_one({"chat_id": chat_id})
|
||||||
return await cleandb.delete_one({"chat_id": chat_id})
|
else:
|
||||||
|
await greetingdb.insert_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
|
# todo other features for custom welcome here
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue