This commit closes #21
This commit is contained in:
parent
4019f2f376
commit
e3fd4b3576
@ -87,9 +87,9 @@ if configGet("enabled", "features", "sponsorships") is True:
|
|||||||
if entry["user"] not in jsonLoad(path.join(configGet("cache", "locations"), "group_members")):
|
if entry["user"] not in jsonLoad(path.join(configGet("cache", "locations"), "group_members")):
|
||||||
continue
|
continue
|
||||||
tg_user = await app.get_users(entry["user"])
|
tg_user = await app.get_users(entry["user"])
|
||||||
until_expiry = relativedelta(datetime.now(), entry["sponsorship"]["expires"]).days
|
until_expiry = abs(relativedelta(datetime.now(), entry["sponsorship"]["expires"]).days)+1
|
||||||
await app.send_message( tg_user.id, locale("sponsorships_expires", "message").format(until_expiry) ) # type: ignore
|
await app.send_message( tg_user.id, locale("sponsorships_expires", "message").format(until_expiry) ) # type: ignore
|
||||||
logWrite(f"Notified user that sponsorship expires in {until_expiry} days")
|
logWrite(f"Notified user {entry['user']} that sponsorship expires in {until_expiry} days")
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
logWrite(f"Could not find user {entry['user']} notify about sponsorship expiry due to '{exp}'")
|
logWrite(f"Could not find user {entry['user']} notify about sponsorship expiry due to '{exp}'")
|
||||||
continue
|
continue
|
||||||
@ -103,7 +103,7 @@ if configGet("enabled", "features", "sponsorships") is True:
|
|||||||
await holo_user.label_reset(configGet("users", "groups"))
|
await holo_user.label_reset(configGet("users", "groups"))
|
||||||
try:
|
try:
|
||||||
tg_user = await app.get_users(entry["user"])
|
tg_user = await app.get_users(entry["user"])
|
||||||
logWrite(f"Notified user that sponsorship expired")
|
logWrite(f"Notified user {entry['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