feat(bot): ✨ Add "Delete My Activity Data" button to p.me.

This commit is contained in:
Nyeki.py
2024-11-02 23:39:18 -03:00
parent c3c44a57a6
commit ddd439d6d7
7 changed files with 135 additions and 228 deletions
+16 -2
View File
@@ -6,7 +6,7 @@ import click
from procs import flush_messages
from payphone.db import setup
from payphone.db import setup, models
from payphone.core import logging
@@ -30,7 +30,21 @@ async def main():
@main.command()
@coroutine
async def flush():
await flush_messages.flush()
"""Flush all messages in Redis to the database. Runs every 5 seconds."""
while True:
await flush_messages.flush()
await asyncio.sleep(5)
@main.command()
@coroutine
async def delete_accounts():
"""Delete all accounts that were scheduled for deletion. Runs every 1 hour."""
while True:
await models.User.filter(is_deleting=True).delete()
await asyncio.sleep(60 * 60)
if __name__ == "__main__":