User bans, emoji and other bug fixes, age limiter, etc #26

Merged
profitroll merged 31 commits from dev into master 2023-01-31 15:26:56 +02:00
Showing only changes of commit e3fd4b3576 - Show all commits

View File

@ -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: