Delete sponsorships on expiry

This commit is contained in:
Profitroll 2022-12-22 22:14:35 +01:00
parent 12da1b2376
commit 5a6a96d3f9
1 changed files with 2 additions and 1 deletions

View File

@ -62,9 +62,10 @@ if configGet("enabled", "scheduler", "sponsorships"):
holo_user = HoloUser(entry["user"])
await app.send_message( entry["user"], locale("sponsorships_expired", "message") ) # type: ignore
await holo_user.label_reset(configGet("destination_group"))
col_sponsorships.find_one_and_delete({"user": holo_user.id})
try:
tg_user = await app.get_users(entry["user"])
logWrite(f"Notified user that sponsorship expires in {until_expiry} days")
logWrite(f"Notified user that sponsorship expired")
except Exception as exp:
logWrite(f"Could not find user {entry['user']} notify about sponsorship expired due to '{exp}'")
except Exception as exp: