Delete sponsorships on expiry
This commit is contained in:
parent
12da1b2376
commit
5a6a96d3f9
@ -62,9 +62,10 @@ if configGet("enabled", "scheduler", "sponsorships"):
|
|||||||
holo_user = HoloUser(entry["user"])
|
holo_user = HoloUser(entry["user"])
|
||||||
await app.send_message( entry["user"], locale("sponsorships_expired", "message") ) # type: ignore
|
await app.send_message( entry["user"], locale("sponsorships_expired", "message") ) # type: ignore
|
||||||
await holo_user.label_reset(configGet("destination_group"))
|
await holo_user.label_reset(configGet("destination_group"))
|
||||||
|
col_sponsorships.find_one_and_delete({"user": holo_user.id})
|
||||||
try:
|
try:
|
||||||
tg_user = await app.get_users(entry["user"])
|
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:
|
except Exception as exp:
|
||||||
logWrite(f"Could not find user {entry['user']} notify about sponsorship expired due to '{exp}'")
|
logWrite(f"Could not find user {entry['user']} notify about sponsorship expired due to '{exp}'")
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
|
Reference in New Issue
Block a user