mirror of
https://github.com/fotoente/MIsskey-ebooks-bot
synced 2024-11-25 04:40:24 +00:00
max is now per user
This commit is contained in:
parent
11d23e07e9
commit
f6036bcc7a
1 changed files with 6 additions and 2 deletions
|
@ -194,8 +194,12 @@ def clean_database():
|
|||
except (TypeError, ValueError) as err:
|
||||
max_notes = "10000"
|
||||
|
||||
data = database.cursor()
|
||||
data.execute("DELETE FROM notes WHERE id NOT IN (SELECT id FROM notes ORDER BY timestamp DESC LIMIT " + max_notes + ");")
|
||||
for user in config.get("misskey", "users").split(";"):
|
||||
username = user.split("@")[1]
|
||||
instance = user.split("@")[2]
|
||||
userid = get_user_id(username, instance)
|
||||
data = database.cursor()
|
||||
data.execute("DELETE FROM notes WHERE user_id=:user_id AND id NOT IN (SELECT id FROM notes WHERE user_id=:user_id ORDER BY timestamp DESC LIMIT :max );", {"user_id": userid, "max": int(max_notes)})
|
||||
|
||||
database.commit()
|
||||
database.close()
|
||||
|
|
Loading…
Reference in a new issue