mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-16 19:35:24 +02:00
Remove message cleanup from webapp
This commit is contained in:
@ -435,17 +435,5 @@ def cleanup_keyval_db():
|
||||
if canCleanupDB():
|
||||
db.session.query(KeyValueProperties).filter(KeyValueProperties.expiration < datetime.datetime.now()).delete()
|
||||
db.session.commit()
|
||||
|
||||
guilds = Guilds.query.all()
|
||||
for guild in guilds:
|
||||
try:
|
||||
channelsjson = json.loads(guild.channels)
|
||||
except:
|
||||
continue
|
||||
for channel in channelsjson:
|
||||
chanid = channel["id"]
|
||||
keep_these = db.session.query(Messages.id).filter(Messages.channel_id == chanid).order_by(Messages.timestamp.desc()).limit(50)
|
||||
db.session.query(Messages).filter(Messages.channel_id == chanid, ~Messages.id.in_(keep_these)).delete(synchronize_session=False)
|
||||
db.session.commit()
|
||||
return ('', 204)
|
||||
abort(401)
|
||||
|
Reference in New Issue
Block a user